Fixed some warnings and crashes (from upstream.)

This commit is contained in:
waltje
2018-02-25 04:19:34 -05:00
parent 440c565d12
commit c39f12691c
3 changed files with 9 additions and 9 deletions

View File

@@ -102,7 +102,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
c = 0;
while (selection->description[0])
while (selection->description && selection->description[0])
{
mbstowcs(lptsTemp, selection->description, strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -153,7 +153,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
val_int = config_get_hex16((char *)config_device->name, (char *)config->name, config->default_int);
c = 0;
while (selection->description[0])
while (selection->description && selection->description[0])
{
mbstowcs(lptsTemp, selection->description, strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -170,7 +170,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
val_int = config_get_hex20((char *)config_device->name, (char *)config->name, config->default_int);
c = 0;
while (selection->description[0])
while (selection->description && selection->description[0])
{
mbstowcs(lptsTemp, selection->description, strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -423,14 +423,14 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
file_filter[0] = 0;
c = 0;
while (config->file_filter[c].description[0])
while (config->file_filter[c].description && config->file_filter[c].description[0])
{
if (c > 0)
strcat(file_filter, "|");
strcat(file_filter, config->file_filter[c].description);
strcat(file_filter, " (");
d = 0;
while (config->file_filter[c].extensions[d][0])
while (config->file_filter[c].extensions[d] && config->file_filter[c].extensions[d][0])
{
if (d > 0)
strcat(file_filter, ";");
@@ -440,7 +440,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
}
strcat(file_filter, ")|");
d = 0;
while (config->file_filter[c].extensions[d][0])
while (config->file_filter[c].extensions[d] && config->file_filter[c].extensions[d][0])
{
if (d > 0)
strcat(file_filter, ";");