hhctrl: Add check for no filename.
This commit is contained in:
parent
92c7e1ae44
commit
9e1d9ef972
|
@ -295,6 +295,9 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
|
||||||
|
|
||||||
ptr += strlen("mapid")+1;
|
ptr += strlen("mapid")+1;
|
||||||
space = strchr(ptr, ' ');
|
space = strchr(ptr, ' ');
|
||||||
|
/* command line ends without number */
|
||||||
|
if (!space)
|
||||||
|
return 0;
|
||||||
memcpy(idtxt, ptr, space-ptr);
|
memcpy(idtxt, ptr, space-ptr);
|
||||||
idtxt[space-ptr] = '\0';
|
idtxt[space-ptr] = '\0';
|
||||||
mapid = atoi(idtxt);
|
mapid = atoi(idtxt);
|
||||||
|
@ -315,6 +318,11 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
|
||||||
len = endq - szCmdLine;
|
len = endq - szCmdLine;
|
||||||
else
|
else
|
||||||
len = strlen(szCmdLine);
|
len = strlen(szCmdLine);
|
||||||
|
|
||||||
|
/* no filename given */
|
||||||
|
if (!len)
|
||||||
|
return 0;
|
||||||
|
|
||||||
buflen = MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, NULL, 0) + 1;
|
buflen = MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, NULL, 0) + 1;
|
||||||
filename = heap_alloc(buflen * sizeof(WCHAR));
|
filename = heap_alloc(buflen * sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, filename, buflen);
|
MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, filename, buflen);
|
||||||
|
|
Loading…
Reference in New Issue