From 016dcc406261b545bac4929910ff503f30e06859 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 6 Apr 2013 18:52:42 +0000 Subject: fix for one very rare crash in Folders options git-svn-id: http://svn.miranda-ng.org/main/trunk@4346 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Folders/src/dlg_handlers.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'plugins/Folders/src/dlg_handlers.cpp') diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index 4419aeb6e1..2f5edb0c96 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -50,6 +50,9 @@ static void LoadRegisteredFolderSections(HWND hWnd) static void LoadRegisteredFolderItems(HWND hWnd) { int idx = SendDlgItemMessage(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETCURSEL, 0, 0); + if (idx == LB_ERR) + return; + char* szSection = (char*)SendDlgItemMessage(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETITEMDATA, idx, 0); HWND hwndItems = GetDlgItem(hWnd, IDC_FOLDERS_ITEMS_LIST); @@ -58,7 +61,7 @@ static void LoadRegisteredFolderItems(HWND hWnd) for (int i=0; i < lstRegisteredFolders.getCount(); i++) { CFolderItem &item = lstRegisteredFolders[i]; if ( !strcmp(szSection, item.GetSection())) { - int idx = SendMessage(hwndItems, LB_ADDSTRING, 0, (LPARAM)TranslateTS(item.GetUserName())); + idx = SendMessage(hwndItems, LB_ADDSTRING, 0, (LPARAM)TranslateTS(item.GetUserName())); SendMessage(hwndItems, LB_SETITEMDATA, idx, (LPARAM)&item); } } -- cgit v1.2.3