Merge pull request #33061 from madmiraal/nullpointerdereference

Call CRASH_COND_MSG if key not found in HashMap get(key) functions.
This commit is contained in:
Rémi Verschelde 2020-07-01 18:20:23 +02:00 committed by GitHub
commit 6cf416dafc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -280,13 +280,13 @@ public:
const TData &get(const TKey &p_key) const {
const TData *res = getptr(p_key);
ERR_FAIL_COND_V(!res, *res);
CRASH_COND_MSG(!res, "Map key not found.");
return *res;
}
TData &get(const TKey &p_key) {
TData *res = getptr(p_key);
ERR_FAIL_COND_V(!res, *res);
CRASH_COND_MSG(!res, "Map key not found.");
return *res;
}