From e1096e29ca66994dbad30fb332b161757621b38a Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Thu, 20 Feb 2014 02:23:38 -0500 Subject: [PATCH] fix absolute path crash --- NBTModel/Data/Nodes/DirectoryDataNode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NBTModel/Data/Nodes/DirectoryDataNode.cs b/NBTModel/Data/Nodes/DirectoryDataNode.cs index 03b9c6b..9d5422a 100644 --- a/NBTModel/Data/Nodes/DirectoryDataNode.cs +++ b/NBTModel/Data/Nodes/DirectoryDataNode.cs @@ -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;