diff --git a/src/common/json.cpp b/src/common/json.cpp index b8c06d73aa..4fbbf9adc7 100644 --- a/src/common/json.cpp +++ b/src/common/json.cpp @@ -10,8 +10,12 @@ namespace json try { std::wifstream file(file_name.data(), std::ios::binary); - using isbi = std::istreambuf_iterator; - return JsonValue::Parse(std::wstring{ isbi{ file }, isbi{} }).GetObjectW(); + if (file.is_open()) + { + using isbi = std::istreambuf_iterator; + return JsonValue::Parse(std::wstring{ isbi{ file }, isbi{} }).GetObjectW(); + } + return std::nullopt; } catch (...) {