mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-03-21 17:24:37 -05:00
fixed root cause of GDrive config parsing crash
This commit is contained in:
parent
96cdb7f488
commit
aee8d777fc
23
src/cfg.cpp
23
src/cfg.cpp
|
|
@ -309,15 +309,20 @@ static void loadDriveConfig()
|
|||
|
||||
if(!clientSecretPath.empty())
|
||||
{
|
||||
json_object *installed, *clientID, *clientSecret,*driveJSON = json_object_from_file(clientSecretPath.c_str());
|
||||
json_object_object_get_ex(driveJSON, "installed", &installed);
|
||||
json_object_object_get_ex(installed, "client_id", &clientID);
|
||||
json_object_object_get_ex(installed, "client_secret", &clientSecret);
|
||||
|
||||
cfg::driveClientID = json_object_get_string(clientID);
|
||||
cfg::driveClientSecret = json_object_get_string(clientSecret);
|
||||
|
||||
json_object_put(driveJSON);
|
||||
json_object *installed, *clientID, *clientSecret, *driveJSON = json_object_from_file(clientSecretPath.c_str());
|
||||
if (driveJSON)
|
||||
{
|
||||
if(json_object_object_get_ex(driveJSON, "installed", &installed))
|
||||
{
|
||||
if(json_object_object_get_ex(installed, "client_id", &clientID)
|
||||
&& json_object_object_get_ex(installed, "client_secret", &clientSecret))
|
||||
{
|
||||
cfg::driveClientID = json_object_get_string(clientID);
|
||||
cfg::driveClientSecret = json_object_get_string(clientSecret);
|
||||
}
|
||||
}
|
||||
json_object_put(driveJSON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user