fix null string error

git-svn-id: https://profuse.googlecode.com/svn/branches/v2@258 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
ksherlock 2010-05-22 16:10:59 +00:00
parent defd397d1b
commit 4a98605123
1 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,13 @@ unsigned BlockDevice::ImageType(const char *type, unsigned defv)
if (type == 0 || *type == 0) return defv;
// type could be a path, eg images/file, disk.images/file
// unix-specifix.
// basename alters the input string
tmp = std::strrchr(type, '/');
if (tmp) type = tmp + 1;
// type could be a filename, in which case we check the extension.
tmp = std::strrchr(type, '.');
if (tmp) type = tmp + 1;
@ -65,7 +72,7 @@ unsigned BlockDevice::ImageType(const char *type, unsigned defv)
// not supported yet.
if (::strcasecmp(tmp, "sdk") == 0)
if (::strcasecmp(type, "sdk") == 0)
return 'SDK_';
return defv;