ExecutionEngine: Check for NULL ErrorStr before using it.
authorJim Grosbach <grosbach@apple.com>
Thu, 10 May 2012 00:31:50 +0000 (00:31 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 10 May 2012 00:31:50 +0000 (00:31 +0000)
Patch by Yury Mikhaylov <yury.mikhaylov@gmail.com>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156523 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/TargetSelect.cpp

index 42364f9b70f774ccb69304da325f8c58741234fc..d3f830e672d94715c7e5ef5d7c30a222ad5fc94f 100644 (file)
@@ -56,8 +56,9 @@ TargetMachine *EngineBuilder::selectTarget(const Triple &TargetTriple,
     }
 
     if (!TheTarget) {
-      *ErrorStr = "No available targets are compatible with this -march, "
-        "see -version for the available targets.\n";
+      if (ErrorStr)
+        *ErrorStr = "No available targets are compatible with this -march, "
+                    "see -version for the available targets.\n";
       return 0;
     }