summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-06 18:52:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-06 18:52:42 +0000
commit016dcc406261b545bac4929910ff503f30e06859 (patch)
tree1b2beb08867db3cb480adbdb40ebd06ffbfa86f2 /plugins
parent2b6daaf2b6282c18722bb33285093fe1e551a676 (diff)
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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Folders/src/dlg_handlers.cpp5
1 files changed, 4 insertions, 1 deletions
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);
}
}