when $LANGUAGE doesn't match any passed language, select the first language, not some random garbage from the stack

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4387 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-11-11 21:27:05 +00:00
parent 94e3af1fdc
commit c6ff05d3a0

View file

@ -31,7 +31,7 @@ struct lang {
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
int i, size; int i, size;
char *selected_language; char *selected_language = NULL;
static HFONT font; static HFONT font;
switch (uMsg) { switch (uMsg) {
case WM_INITDIALOG: case WM_INITDIALOG:
@ -46,7 +46,10 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
} }
// select the current language // select the current language
SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SELECTSTRING, -1, (LPARAM) selected_language); if (selected_language)
SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SELECTSTRING, -1, (LPARAM) selected_language);
else
SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SETCURSEL, 0, 0);
// set texts // set texts
SetDlgItemText(hwndDlg, IDC_TEXT, g_wndtext); SetDlgItemText(hwndDlg, IDC_TEXT, g_wndtext);
SetWindowText(hwndDlg, g_wndtitle); SetWindowText(hwndDlg, g_wndtitle);