aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Konstantin Varlamov <varconst@google.com>2019-07-20 18:01:40 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2019-08-14 12:36:59 -0400
commit3ae1a1837d19de42fdb276d3edabbb7c501ed65e (patch)
treee45dd6fdbc2746b9b88b9aa608fb58a32662b4ba
parent80704a61eab151018384000d4e83f7f512ee55f5 (diff)
Fix GTMGoogleTestRunner triggering "NULL cString" exception in NSString.
-rw-r--r--UnitTesting/GTMGoogleTestRunner.mm3
1 files changed, 2 insertions, 1 deletions
diff --git a/UnitTesting/GTMGoogleTestRunner.mm b/UnitTesting/GTMGoogleTestRunner.mm
index 0bcb500..018f815 100644
--- a/UnitTesting/GTMGoogleTestRunner.mm
+++ b/UnitTesting/GTMGoogleTestRunner.mm
@@ -86,7 +86,8 @@ class GoogleTestPrinter : public EmptyTestEventListener {
virtual void OnTestPartResult(const TestPartResult &test_part_result) {
if (!test_part_result.passed()) {
- NSString *file = @(test_part_result.file_name());
+ const char *file_name = test_part_result.file_name();
+ NSString *file = @(file_name ? file_name : "<file name unavailable>");
int line = test_part_result.line_number();
NSString *summary = @(test_part_result.summary());