mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-28 20:09:38 +08:00
Fixed crash in SDL_startswith() when passed NULL strings
Fixes https://github.com/libsdl-org/SDL/issues/15451
This commit is contained in:
+2
-1
@@ -111,7 +111,8 @@ void SDL_CalculateFraction(float x, int *numerator, int *denominator)
|
|||||||
|
|
||||||
bool SDL_startswith(const char *string, const char *prefix)
|
bool SDL_startswith(const char *string, const char *prefix)
|
||||||
{
|
{
|
||||||
if (SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0) {
|
if (string && prefix &&
|
||||||
|
SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user