fix absolute path crash

This commit is contained in:
Justin Aquadro 2014-02-20 02:23:38 -05:00
parent b303551fa0
commit e1096e29ca

View file

@ -33,7 +33,7 @@ namespace NBTExplorer.Model
{
string path = (_path.EndsWith("/") || _path.EndsWith("\\")) ? _path : _path + '/';
string name = Path.GetDirectoryName(path);
string name = Path.GetDirectoryName(path) ?? path.Substring(0, path.Length - 1);
int sepIndex = Math.Max(name.LastIndexOf('/'), name.LastIndexOf('\\'));
return (sepIndex > 0) ? name.Substring(sepIndex + 1) : name;