mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-01 04:01:56 +02:00
Fix crash caused by malformed preference files, fixes #110
This commit is contained in:
@@ -83,9 +83,9 @@ Client::Client():
|
|||||||
configFile.seekg(0, std::ios::beg);
|
configFile.seekg(0, std::ios::beg);
|
||||||
if(fsize)
|
if(fsize)
|
||||||
{
|
{
|
||||||
json::Reader::Read(configDocument, configFile);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
json::Reader::Read(configDocument, configFile);
|
||||||
authUser.ID = ((json::Number)(configDocument["User"]["ID"])).Value();
|
authUser.ID = ((json::Number)(configDocument["User"]["ID"])).Value();
|
||||||
authUser.SessionID = ((json::String)(configDocument["User"]["SessionID"])).Value();
|
authUser.SessionID = ((json::String)(configDocument["User"]["SessionID"])).Value();
|
||||||
authUser.SessionKey = ((json::String)(configDocument["User"]["SessionKey"])).Value();
|
authUser.SessionKey = ((json::String)(configDocument["User"]["SessionKey"])).Value();
|
||||||
@@ -102,7 +102,7 @@ Client::Client():
|
|||||||
catch (json::Exception &e)
|
catch (json::Exception &e)
|
||||||
{
|
{
|
||||||
authUser = User(0, "");
|
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();
|
configFile.close();
|
||||||
|
Reference in New Issue
Block a user