From 60199805e603c347ff1a00c98c541ec12dd7de2d Mon Sep 17 00:00:00 2001
From: Matt Borgerson <contact@mborgerson.com>
Date: Thu, 26 Mar 2020 00:17:47 -0700
Subject: [PATCH] ui: Fix crash on empty path in Cocoa file select dialog

---
 ui/noc_file_dialog.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/noc_file_dialog.h b/ui/noc_file_dialog.h
index 5fb8e0013f..afb537b27a 100644
--- a/ui/noc_file_dialog.h
+++ b/ui/noc_file_dialog.h
@@ -242,7 +242,7 @@ const char *noc_file_dialog_open(int flags,
         [open_panel setCanChooseFiles:NO];
     }
 
-    if (default_path) {
+    if (default_path && (strlen(default_path) > 0)) {
         default_url = [NSURL fileURLWithPath:
             [NSString stringWithUTF8String:default_path]];
         [panel setDirectoryURL:default_url];