From a16909cbcbf6d18ab622ac5bbb05a8d743a93db3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Feb 2016 09:12:35 +0000 Subject: crash fix for drag-n-drop in trees git-svn-id: http://svn.miranda-ng.org/main/trunk@16343 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/src/ui_utils.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mir_core') 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) { -- cgit v1.2.3