From 6cd5f90f73c4e2e6c02b81dd9607db0ea9d64099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sat, 8 Nov 2008 15:58:06 +0000 Subject: [PATCH] StyledEdit now alerts with "unsupported format" instead of "Bad argument type passed to function" (bug #3071) OpenFile() now returns early when the format is unsupported (don't add the document to recent documents, don't allow to save the document) (bug #3072) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28565 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/stylededit/StyledEditWindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index e853d7504f..ae38c919cc 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -892,7 +892,11 @@ StyledEditWindow::_LoadFile(entry_ref* ref) strcpy(name, "???"); BString text("Error loading \""); - text << name << "\":\n\t" << strerror(status); + text << name << "\":\n\t"; + if (status == B_BAD_TYPE) + text << "Unsupported format"; + else + text << strerror(status); _ShowAlert(text, "OK", "", "", B_STOP_ALERT); return status; @@ -924,6 +928,7 @@ StyledEditWindow::OpenFile(entry_ref* ref) if (_LoadFile(ref) != B_OK) { fSaveItem->SetEnabled(true); // allow saving new files + return; } be_roster->AddToRecentDocuments(ref, APP_SIGNATURE);