From 8495a9d8f358a72e6e9732fff2dea6221a07147e Mon Sep 17 00:00:00 2001
From: noryb009 <noryb009@hotmail.com>
Date: Sun, 5 Jan 2014 16:51:29 -0500
Subject: [PATCH] Fix coverity CID 611220: unchecked dynamic_cast
---
src/apps/debugger/model/Type.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/apps/debugger/model/Type.cpp b/src/apps/debugger/model/Type.cpp
index 318abf2..a45d2c4 100644
a
|
b
|
ArrayDimension::CountElements() const
|
44 | 44 | { |
45 | 45 | Type* type = GetType(); |
46 | 46 | |
47 | | if (type->Kind() == TYPE_ENUMERATION) |
48 | | return dynamic_cast<EnumerationType*>(type)->CountValues(); |
| 47 | if (type->Kind() == TYPE_ENUMERATION) { |
| 48 | EnumerationType* enumeration = dynamic_cast<EnumerationType*>(type); |
| 49 | if (enumeration != NULL) |
| 50 | return enumeration->CountValues(); |
| 51 | else |
| 52 | return 0; |
| 53 | } |
49 | 54 | |
50 | 55 | if (type->Kind() == TYPE_SUBRANGE) { |
51 | 56 | SubrangeType* subrangeType = dynamic_cast<SubrangeType*>(type); |