@@ -177,26 +177,26 @@ void AsciiComposer::LoadConfig(Schema* schema) {
177
177
good_old_caps_lock_ = false ;
178
178
if (!schema)
179
179
return ;
180
- the<Config> preset_config (
181
- Config::Require (" config" )->Create (" default" ));
182
- if (preset_config) {
183
- preset_config->GetBool (" ascii_composer/good_old_caps_lock" ,
184
- &good_old_caps_lock_);
185
- }
186
180
Config* config = schema->config ();
187
- auto bindings = config->GetMap (" ascii_composer/switch_key" );
188
- if (!bindings) {
189
- if (!preset_config) {
190
- LOG (ERROR) << " Error importing preset ascii bindings." ;
191
- return ;
192
- }
193
- bindings = preset_config->GetMap (" ascii_composer/switch_key" );
194
- if (!bindings) {
195
- LOG (WARNING) << " missing preset ascii bindings." ;
196
- return ;
181
+ the<Config> preset_config (Config::Require (" config" )->Create (" default" ));
182
+ if (!config->GetBool (" ascii_composer/good_old_caps_lock" ,
183
+ &good_old_caps_lock_)) {
184
+ if (preset_config) {
185
+ preset_config->GetBool (" ascii_composer/good_old_caps_lock" ,
186
+ &good_old_caps_lock_);
197
187
}
198
188
}
199
- load_bindings (bindings, &bindings_);
189
+ if (auto bindings = config->GetMap (" ascii_composer/switch_key" )) {
190
+ load_bindings (bindings, &bindings_);
191
+ }
192
+ else if (auto bindings = preset_config
193
+ ? preset_config->GetMap (" ascii_composer/switch_key" )
194
+ : nullptr ) {
195
+ load_bindings (bindings, &bindings_);
196
+ } else {
197
+ LOG (ERROR) << " Missing ascii bindings." ;
198
+ return ;
199
+ }
200
200
auto it = bindings_.find (XK_Caps_Lock);
201
201
if (it != bindings_.end ()) {
202
202
caps_lock_switch_style_ = it->second ;
0 commit comments