From e2135de0222b8fe8aa45a3d1c2836195ddc44a58 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 26 Apr 2018 14:34:49 +0200 Subject: [PATCH] Fix CID 1385633 (Dereference before null check) Signed-off-by: Stefan Weil --- src/ccutil/elst.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ccutil/elst.cpp b/src/ccutil/elst.cpp index 3d743590..36f2cf46 100644 --- a/src/ccutil/elst.cpp +++ b/src/ccutil/elst.cpp @@ -210,11 +210,13 @@ ELIST_LINK *ELIST_ITERATOR::forward() { cycle_pt = next; current = next; } +#ifndef NDEBUG + if (!current) + NULL_DATA.error ("ELIST_ITERATOR::forward", ABORT, nullptr); +#endif next = current->next; #ifndef NDEBUG - if (!current) - NULL_DATA.error ("ELIST_ITERATOR::forward", ABORT, nullptr); if (!next) NULL_NEXT.error ("ELIST_ITERATOR::forward", ABORT, "This is: %p Current is: %p", this, current);