From fc1274f381d3c9b375779c9dcbd4d43ba1e26f58 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 14 Aug 2012 18:14:06 +0100 Subject: [PATCH] Fix crash caused by malformed preference files, fixes #110 --- src/client/Client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/Client.cpp b/src/client/Client.cpp index f6744cfd8..4d08f14b4 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -83,9 +83,9 @@ Client::Client(): configFile.seekg(0, std::ios::beg); if(fsize) { - json::Reader::Read(configDocument, configFile); try { + json::Reader::Read(configDocument, configFile); authUser.ID = ((json::Number)(configDocument["User"]["ID"])).Value(); authUser.SessionID = ((json::String)(configDocument["User"]["SessionID"])).Value(); authUser.SessionKey = ((json::String)(configDocument["User"]["SessionKey"])).Value(); @@ -102,7 +102,7 @@ Client::Client(): catch (json::Exception &e) { authUser = User(0, ""); - std::cerr << "Error: Client [Read User data from pref] " << e.what() << std::endl; + std::cerr << "Error: Could not read data from prefs: " << e.what() << std::endl; } } configFile.close();