Merge pull request #5662 from RobLoach/strdup

Fix strdup() call when no path is provided
This commit is contained in:
Twinaphex 2017-11-08 17:36:44 +01:00 committed by GitHub
commit e7188d9444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,7 +330,9 @@ RFILE *filestream_open(const char *path, unsigned mode, ssize_t len)
{
const char *ld = (const char*)strrchr(path, '.');
stream->ext = strdup(ld ? ld + 1 : "");
if (ld) {
stream->ext = strdup(ld + 1);
}
}
filestream_set_size(stream);