diff options
author | Dastgir <dastgirp@gmail.com> | 2018-07-29 16:43:15 +0530 |
---|---|---|
committer | Dastgir <dastgirp@gmail.com> | 2018-07-29 17:06:37 +0530 |
commit | 18678ca6a144bd7bfdec1aa95feb9c19301d67dd (patch) | |
tree | 07ce6d3d1bf2e849a408450065a92d2cfe1e8be8 | |
parent | b30f62468a5e923bf5d9533adec064ada1716459 (diff) | |
download | hercules-18678ca6a144bd7bfdec1aa95feb9c19301d67dd.tar.gz hercules-18678ca6a144bd7bfdec1aa95feb9c19301d67dd.tar.bz2 hercules-18678ca6a144bd7bfdec1aa95feb9c19301d67dd.tar.xz hercules-18678ca6a144bd7bfdec1aa95feb9c19301d67dd.zip |
Fix issues reported by coverity scan
-rw-r--r-- | src/map/achievement.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/map/achievement.c b/src/map/achievement.c index 0369b0fb5..6abdb74ee 100644 --- a/src/map/achievement.c +++ b/src/map/achievement.c @@ -1378,11 +1378,10 @@ static bool achievement_readdb_validate_criteria_itemtype(const struct config_se } } else if ((tt = libconfig->setting_get_member(t, "ItemType")) && config_setting_is_array(tt)) { int j = 0; - uint32 it_type = 0; while (j < libconfig->setting_length(tt)) { if ((val = libconfig->setting_get_int_elem(tt, j))) { - if (val < IT_HEALING || val >= IT_MAX) { + if (val < IT_HEALING || val > IT_MAX) { ShowError("achievement_readdb_validate_criteria_itemtype: Invalid ItemType %d provided (Achievement: %d, Objective: %d). Skipping...\n", val, entry_id, obj_idx); continue; } @@ -1405,8 +1404,6 @@ static bool achievement_readdb_validate_criteria_itemtype(const struct config_se } j++; } - - obj->item_type = it_type; } else if (achievement_criteria_itemtype(type)) { ShowError("achievement_readdb_validate_criteria_itemtype: Criteria requires a ItemType field (Achievement: %d, Objective: %d). Skipping...\n", entry_id, obj_idx); return false; @@ -1780,7 +1777,7 @@ static void achievement_readb(void) if (libconfig->setting_lookup_int(conf, "Id", &t_ad.id) == 0) { ShowError("achievement_readdb: Id field for entry %d is not provided! Skipping...\n", entry); continue; - } else if (t_ad.id <= 0 || t_ad.id > INT32_MAX) { + } else if (t_ad.id <= 0) { ShowError("achievement_readdb: Invalid Id %d for entry %d. Skipping...\n", t_ad.id, entry); continue; } |