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)".
This commit is contained in:
Michal Schulz 2021-06-06 15:16:12 +02:00 committed by Jeff Young
parent 2078483f50
commit f923649801
1 changed files with 10 additions and 1 deletions

View File

@ -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;
}