@@ -42,16 +42,22 @@ void PCSX::VersionInfo::loadFromFile(IO<File> file) {
42
42
version = json[" version" ].template get <std::string>();
43
43
changeset = json[" changeset" ].template get <std::string>();
44
44
timestamp = json[" timestamp" ].template get <std::time_t >();
45
+ } catch (...) {
46
+ clear ();
47
+ return ;
48
+ }
49
+ try {
45
50
updateCatalog = json[" updateInfo" ][0 ][" updateCatalog" ].template get <std::string>();
46
51
updateInfoBase = json[" updateInfo" ][0 ][" updateInfoBase" ].template get <std::string>();
47
52
} catch (...) {
48
- clear ();
53
+ updateCatalog.clear ();
54
+ updateInfoBase.clear ();
49
55
}
50
56
}
51
57
52
58
bool PCSX::Update::downloadUpdateInfo (const VersionInfo& versionInfo, std::function<void (bool )> callback,
53
59
uv_loop_t* loop) {
54
- if (versionInfo.failed ()) return false ;
60
+ if (versionInfo.failed () || !versionInfo. hasUpdateInfo () ) return false ;
55
61
m_hasUpdate = false ;
56
62
m_download = new UvFile (
57
63
versionInfo.updateCatalog ,
@@ -89,7 +95,7 @@ bool PCSX::Update::downloadUpdateInfo(const VersionInfo& versionInfo, std::funct
89
95
90
96
bool PCSX::Update::downloadAndApplyUpdate (const VersionInfo& versionInfo, std::function<void (bool )> callback,
91
97
uv_loop_t* loop) {
92
- if (versionInfo.failed ()) return false ;
98
+ if (versionInfo.failed () || !versionInfo. hasUpdateInfo () ) return false ;
93
99
m_hasUpdate = false ;
94
100
m_download = new UvFile (
95
101
versionInfo.updateInfoBase + std::to_string (m_updateId),
@@ -124,7 +130,7 @@ bool PCSX::Update::downloadAndApplyUpdate(const VersionInfo& versionInfo, std::f
124
130
125
131
bool PCSX::Update::getDownloadUrl (const VersionInfo& versionInfo, std::function<void (std::string)> callback,
126
132
uv_loop_t* loop) {
127
- if (versionInfo.failed ()) return false ;
133
+ if (versionInfo.failed () || !versionInfo. hasUpdateInfo () ) return false ;
128
134
m_hasUpdate = false ;
129
135
m_download = new UvFile (
130
136
versionInfo.updateInfoBase + std::to_string (m_updateId),
0 commit comments