File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -208,7 +208,12 @@ bool Device::loadState(string path) {
208
208
f.open (path+S (" .json" ));
209
209
210
210
if (f.is_open ()) {
211
- f>>data;
211
+ try {
212
+ f>>data;
213
+ } catch (nlohmann::detail::parse_error& e) {
214
+ imLogE (" error while loading device state: %s\n " ,e.what ());
215
+ return false ;
216
+ }
212
217
} else {
213
218
// load default state...
214
219
mappings.push_back (new bindSet (" Default" ));
@@ -273,7 +278,12 @@ bool loadMacros(string path) {
273
278
f.open (path);
274
279
275
280
if (f.is_open ()) {
276
- f>>data;
281
+ try {
282
+ f>>data;
283
+ } catch (nlohmann::detail::parse_error& e) {
284
+ imLogE (" error while loading macros: %s\n " ,e.what ());
285
+ return false ;
286
+ }
277
287
} else {
278
288
imLogI (" macros will be saved.\n " );
279
289
return false ;
You can’t perform that action at this time.
0 commit comments