Преглед изворни кода

Catch exceptions thrown by `[value description]`

Tanner Bennett пре 8 година
родитељ
комит
a6ad98dd53
1 измењених фајлова са 8 додато и 4 уклоњено
  1. 8 4
      Classes/Utility/FLEXRuntimeUtility.m

+ 8 - 4
Classes/Utility/FLEXRuntimeUtility.m

@@ -155,10 +155,14 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
         }
     }
     
-    if (!description) {
-        // Single line display - replace newlines and tabs with spaces.
-        description = [[value description] stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
-        description = [description stringByReplacingOccurrencesOfString:@"\t" withString:@" "];
+    @try {
+        if (!description) {
+            // Single line display - replace newlines and tabs with spaces.
+            description = [[value description] stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
+            description = [description stringByReplacingOccurrencesOfString:@"\t" withString:@" "];
+        }
+    } @catch (NSException *e) {
+        description = [@"Thrown: " stringByAppendingString:e.reason ?: @"(nil exception reason)"];
     }
     
     if (!description) {