From 0b99825ba8d53ec5586dbe08170fd15423d07ef6 Mon Sep 17 00:00:00 2001 From: Scott Hanson Date: Sat, 4 Jan 2025 16:28:13 -0500 Subject: [PATCH] fix preview/model import crash if click select sibling on a preview --- xLights/ImportPreviewsModelsDialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xLights/ImportPreviewsModelsDialog.cpp b/xLights/ImportPreviewsModelsDialog.cpp index 5a8b19d0f8..27682ef439 100644 --- a/xLights/ImportPreviewsModelsDialog.cpp +++ b/xLights/ImportPreviewsModelsDialog.cpp @@ -379,7 +379,8 @@ void ImportPreviewsModelsDialog::SelectRecursiveModel(wxString m, bool checked) for (wxTreeListItem it = TreeListCtrl1->GetFirstItem(); it.IsOk(); it = TreeListCtrl1->GetNextItem(it)) { if (model == TreeListCtrl1->GetItemText(it)) { TreeListCtrl1->CheckItem(it, checked ? wxCHK_CHECKED : wxCHK_UNCHECKED); - if (((impTreeItemData*)TreeListCtrl1->GetItemData(it))->IsModelGroup()) { + auto* itm = ((impTreeItemData*)TreeListCtrl1->GetItemData(it)); + if (itm && itm->IsModelGroup()) { wxString const models = ((impTreeItemData*)TreeListCtrl1->GetItemData(it))->GetModelXml()->GetAttribute("models"); wxArrayString const modelArray = wxSplit(models, ','); for (size_t i = 0; i < modelArray.size(); ++i) {