From 649ddde05f788ed1749b8d3488b03f082bf85a2b Mon Sep 17 00:00:00 2001 From: Ryan Leavengood Date: Wed, 26 Apr 2006 05:28:55 +0000 Subject: [PATCH] Fixing bug 541: The arguments passed on the command-line were not checked if they were files before being opened. This caused StyledEdit to crash if a directory was one of the arguments. Now each argument being passed is checked to see if it is a file before being opened, and if all arguments are directories, an empty document will be opened. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17235 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/stylededit/StyledEditApp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/apps/stylededit/StyledEditApp.cpp b/src/apps/stylededit/StyledEditApp.cpp index f2c730008c..32680cd342 100644 --- a/src/apps/stylededit/StyledEditApp.cpp +++ b/src/apps/stylededit/StyledEditApp.cpp @@ -220,7 +220,11 @@ StyledEditApp::ArgvReceived(int32 argc, const char* argv[], const char* cwd) fprintf(stderr, "Entry not found: \"%s\".\n", path.Path()); continue; } - OpenDocument(&ref); + BEntry entry(&ref); + if (entry.IsFile()) + OpenDocument(&ref); + else if (fWindowCount == 0) + OpenDocument(); } }