Browse Source

bugfix if file not exists

Nicolas Cannasse 5 years ago
parent
commit
ac283e164b
1 changed files with 8 additions and 2 deletions
  1. 8 2
      hide/view/FileView.hx

+ 8 - 2
hide/view/FileView.hx

@@ -22,8 +22,14 @@ class FileView extends hide.ui.View<{ path : String }> {
 	}
 
 	override function rebuild() {
-		if( state.path != null )
-			saveDisplayKey = Type.getClassName(Type.getClass(this)) + ":" + getPath().split("\\").join("/");
+		var path = getPath();
+		if( path != null ) {
+			saveDisplayKey = Type.getClassName(Type.getClass(this)) + ":" + path.split("\\").join("/");
+			if( !sys.FileSystem.exists(path) ) {
+				element.html('${state.path} no longer exists');
+				return;
+			}
+		}
 		super.rebuild();
 	}