Fix strdup() call when no path is provided

This commit is contained in:
Rob Loach 2017-11-08 11:31:17 -05:00
parent 9f79b99c94
commit 9f222010de
No known key found for this signature in database
GPG Key ID: 627C60834A74A21A

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);