diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index eb5d7181a3..ce6ca8920e 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -286,8 +286,9 @@ const char *path_get_archive_delim(const char *path) */ const char *path_get_extension(const char *path) { - if (!string_is_empty(path)) - return strrchr(path_basename(path), '.') + 1; + const char *ext; + if (!string_is_empty(path) && ((ext = strrchr(path_basename(path), '.')))) + return ext + 1; return ""; }