From 1a227763667c7f6c6b2bd929c88c28538014f5b8 Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Thu, 9 Oct 2014 00:53:45 -0400
Subject: [PATCH] testing for valid model index before creating new index in
 SceneWinModel

---
 modules/gui/src/scene_win/scene_win_model.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/gui/src/scene_win/scene_win_model.cc b/modules/gui/src/scene_win/scene_win_model.cc
index 4fc10d492..2acc15eb3 100644
--- a/modules/gui/src/scene_win/scene_win_model.cc
+++ b/modules/gui/src/scene_win/scene_win_model.cc
@@ -114,6 +114,9 @@ void SceneWinModel::Update()
 QModelIndex SceneWinModel::index(int row, int col, 
                                  const QModelIndex& parent) const
 {
+  if (!hasIndex(row, col, parent)){
+    return QModelIndex();
+  }
   SceneNode* parent_node = GetItem(parent);
 
   if (parent_node->children().size() <= row)
-- 
GitLab