Commit f9c9ea63 authored by Carlo Bramini's avatar Carlo Bramini Committed by Alexandre Julliard

shlwapi: Don't remove nonexistent extension in PathRemoveExtension.

parent e94b8302
...@@ -760,6 +760,10 @@ void WINAPI PathRemoveArgsW(LPWSTR lpszPath) ...@@ -760,6 +760,10 @@ void WINAPI PathRemoveArgsW(LPWSTR lpszPath)
* PARAMS * PARAMS
* lpszPath [I/O] Path to remove the extension from * lpszPath [I/O] Path to remove the extension from
* *
* NOTES
* The NUL terminator must be written only if extension exists
* and if the pointed character is not already NUL.
*
* RETURNS * RETURNS
* Nothing. * Nothing.
*/ */
...@@ -770,7 +774,8 @@ void WINAPI PathRemoveExtensionA(LPSTR lpszPath) ...@@ -770,7 +774,8 @@ void WINAPI PathRemoveExtensionA(LPSTR lpszPath)
if (lpszPath) if (lpszPath)
{ {
lpszPath = PathFindExtensionA(lpszPath); lpszPath = PathFindExtensionA(lpszPath);
*lpszPath = '\0'; if (lpszPath && *lpszPath != '\0')
*lpszPath = '\0';
} }
} }
...@@ -786,7 +791,8 @@ void WINAPI PathRemoveExtensionW(LPWSTR lpszPath) ...@@ -786,7 +791,8 @@ void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
if (lpszPath) if (lpszPath)
{ {
lpszPath = PathFindExtensionW(lpszPath); lpszPath = PathFindExtensionW(lpszPath);
*lpszPath = '\0'; if (lpszPath && *lpszPath != '\0')
*lpszPath = '\0';
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment