diff --git a/src/rcore.c b/src/rcore.c index 62f3938a0..362cbab98 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1946,17 +1946,21 @@ const char *GetFileName(const char *filePath) // Get filename string without extension (uses static string) const char *GetFileNameWithoutExt(const char *filePath) { - const char *fileName = GetFileName(filePath); - int pos = (int)strlen(fileName); - for(int i = pos; i>0; i--) + if (filePath != NULL) { - if(fileName[i] == '.') + const char *fileName = GetFileName(filePath); + int pos = (int)strlen(fileName); + for(int i = pos; i>0; i--) { - pos = i; - break; + if(fileName[i] == '.') + { + pos = i; + break; + } } + return TextSubtext(fileName,0,pos); } - return TextSubtext(fileName,0,pos); + return ""; } // Get directory for a given filePath