From f923649801d523326c9a3ae78870fec32ed99ca0 Mon Sep 17 00:00:00 2001 From: Michal Schulz Date: Sun, 6 Jun 2021 15:16:12 +0200 Subject: [PATCH] If NSError contains recovery suggestion string, append it to error message as it was until now. However, if recovery string is NIL, do not append it at all. This MR fixes the "error message\n\n(null)". --- libs/kiplatform/osx/environment.mm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/kiplatform/osx/environment.mm b/libs/kiplatform/osx/environment.mm index e6bc5967e4..4a3bc77986 100644 --- a/libs/kiplatform/osx/environment.mm +++ b/libs/kiplatform/osx/environment.mm @@ -47,7 +47,16 @@ bool KIPLATFORM::ENV::MoveToTrash( const wxString& aPath, wxString& aError ) if( result == NO ) { NSString* errmsg; - errmsg = [err.localizedFailureReason stringByAppendingFormat:@"\n\n%@", err.localizedRecoverySuggestion]; + + if( err.localizedRecoverySuggestion == nil ) + { + errmsg = err.localizedFailureReason; + } + else + { + errmsg = [err.localizedFailureReason stringByAppendingFormat:@"\n\n%@", err.localizedRecoverySuggestion]; + } + aError = wxCFStringRef::AsString( (CFStringRef) errmsg ); return false; }