Skip to content

Commit e75b21f

Browse files
committed
even more fixes
1 parent 09224ee commit e75b21f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/daemon/state.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,12 @@ bool Device::loadState(string path) {
208208
f.open(path+S(".json"));
209209

210210
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+
}
212217
} else {
213218
// load default state...
214219
mappings.push_back(new bindSet("Default"));
@@ -273,7 +278,12 @@ bool loadMacros(string path) {
273278
f.open(path);
274279

275280
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+
}
277287
} else {
278288
imLogI("macros will be saved.\n");
279289
return false;

0 commit comments

Comments
 (0)