check for existance of KEY_DOWNLOAD_STATE entry before trying to read its value

This commit is contained in:
Dale Stammen 2015-05-28 13:33:38 -07:00
parent 736de4e37c
commit 2aec149316
1 changed files with 2 additions and 3 deletions

View File

@ -329,10 +329,9 @@ void Manifest::setAssetDownloadState(const std::string &key, const Manifest::Dow
std::string jkey = itr->name.GetString();
if (jkey == key) {
rapidjson::Value &entry = itr->value;
rapidjson::Value &value = entry[KEY_DOWNLOAD_STATE];
if (value.IsInt())
if (entry.HasMember(KEY_DOWNLOAD_STATE) && entry[KEY_DOWNLOAD_STATE].IsInt())
{
value.SetInt((int)state);
entry[KEY_DOWNLOAD_STATE].SetInt((int) state);
}
else
{