summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mir_core/src/ui_utils.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp
index de9d41bb11..3d89cc49a2 100644
--- a/src/mir_core/src/ui_utils.cpp
+++ b/src/mir_core/src/ui_utils.cpp
@@ -1460,12 +1460,15 @@ LRESULT CCtrlTreeView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam)
else if (hti.flags & TVHT_BELOW)
hti.hItem = TVI_LAST;
- HTREEITEM insertAfter = hti.hItem;
- HTREEITEM hParent = (insertAfter == TVI_FIRST) ? NULL : GetParent(insertAfter);
- if (GetChild(insertAfter) != NULL) {
- hParent = insertAfter;
- insertAfter = TVI_FIRST;
+ HTREEITEM insertAfter = hti.hItem, hParent;
+ if (insertAfter != TVI_FIRST) {
+ hParent = GetParent(insertAfter);
+ if (GetChild(insertAfter) != NULL) {
+ hParent = insertAfter;
+ insertAfter = TVI_FIRST;
+ }
}
+ else hParent = NULL;
HTREEITEM FirstItem = NULL;
if (m_bMultiSelect) {