From 661c2e5919f7f35d6b553e4e6a778bb5583e23a4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 18 May 2016 09:39:19 +0200 Subject: [PATCH] - added missing NULL pointer check to ACS's CheckInventory. --- src/p_acs.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 032abbc27c..3248e738cf 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1333,9 +1333,13 @@ static int CheckInventory (AActor *activator, const char *type, bool max) if (max) { if (item) + { return item->MaxAmount; - else - return ((AInventory *)GetDefaultByType (info))->MaxAmount; + } + else if (info != nullptr && info->IsDescendantOf(RUNTIME_CLASS(AInventory))) + { + return ((AInventory *)GetDefaultByType(info))->MaxAmount; + } } return item ? item->Amount : 0; }