Skip to content

Commit

Permalink
Debugger: Fix potential crash in VariablesView.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anevilyak committed Jun 27, 2015
1 parent 55c1477 commit 299f564
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions 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.
*/

Expand Down Expand Up @@ -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)
Expand All @@ -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;

Expand Down

0 comments on commit 299f564

Please sign in to comment.