From 299f564e06bc45615f167d81e8a95d5057b444ee Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 27 Jun 2015 12:49:42 -0400 Subject: [PATCH] Debugger: Fix potential crash in VariablesView. VariableTableModel: - When attempting to retrieve the type for a given node, ensure that it actually has a value node first. This might not necessarily be the case if no appropriate type handler was found. --- .../gui/team_window/VariablesView.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index 563f119810..33feb49f66 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011-2014, Rene Gollent, rene@gollent.com. + * Copyright 2011-2015, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -1414,8 +1414,12 @@ VariablesView::VariableTableModel::GetValueAt(void* object, int32 columnIndex, if (location == NULL) return false; - Type* nodeChildRawType = node->NodeChild()->Node()->GetType() - ->ResolveRawType(false); + ValueNode* childNode = node->NodeChild()->Node(); + if (childNode == NULL) + return false; + + Type* nodeChildRawType = childNode->GetType()->ResolveRawType( + false); if (nodeChildRawType->Kind() == TYPE_COMPOUND) { if (location->CountPieces() > 1) @@ -1440,7 +1444,11 @@ VariablesView::VariableTableModel::GetValueAt(void* object, int32 columnIndex, // use the type of the underlying value node, as it may // be different from the initially assigned top level type // due to casting - Type* type = node->NodeChild()->Node()->GetType(); + ValueNode* childNode = node->NodeChild()->Node(); + if (childNode == NULL) + return false; + + Type* type = childNode->GetType(); if (type == NULL) return false;