Skip to content

Commit

Permalink
Don't crash on parsing error pierr3#50
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeter2 committed Sep 4, 2020
1 parent e92a7e7 commit dafed22
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions vSMR/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ void CConfig::loadConfig() {
CString msg;
msg.Format("An error parsing vSMR configuration occurred. Error: %s (Offset: %i)\nOnce fixed, reload the config by typing '.smr reload'", document.GetParseError(), document.GetErrorOffset());
AfxMessageBox(msg, MB_OK);

ASSERT(AfxGetMainWnd() != NULL);
AfxGetMainWnd()->SendMessage(WM_CLOSE);

document.Parse<0>("[{"
"\"name\": \"Default\","
"\"font\": {"
"\"font_name\": \"EuroScope\","
"\"weight\": \"Regular\","
"\"sizes\": {\"one\": 0,\"two\": 0,\"three\": 0,\"four\": 0,\"five\": 0}},"
"\"rimcas\": {\"timer\": [0],\"timer_lvp\": [0],\"rimcas_stage_two_speed_threshold\": 0},"
"\"labels\": {\"leader_line_length\": 0,\"use_aspeed_for_gate\": false,\"airborne\": {\"use_departure_arrival_coloring\": false}},"
"\"filters\": {\"hide_above_alt\": 0,\"hide_below_alt\": 0,\"hide_above_spd\": 0,\"show_on_rwy\": true,\"radar_range_nm\": 0,\"night_alpha_setting\": 0,\"pro_mode\": {\"enable\": false}},"
"\"targets\": {\"show_primary_target\": false},"
"\"approach_insets\": {\"extended_lines_length\": 0,\"extended_lines_ticks_spacing\": 1,\"background_color\": {\"r\": 127,\"g\": 122,\"b\": 122},\"extended_lines_color\": {\"r\": 0,\"g\": 0,\"b\": 0},\"runway_color\": {\"r\": 0,\"g\": 0,\"b\": 0}}"
"}]");
}

profiles.clear();
Expand Down

0 comments on commit dafed22

Please sign in to comment.