[Lldb-commits] [lldb] d227c8a - Add missing nullptr check.

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 5 09:49:04 PDT 2023


Author: Adrian Prantl
Date: 2023-09-05T09:48:06-07:00
New Revision: d227c8a1200081fdab14e93165927787544c5f12

URL: https://github.com/llvm/llvm-project/commit/d227c8a1200081fdab14e93165927787544c5f12
DIFF: https://github.com/llvm/llvm-project/commit/d227c8a1200081fdab14e93165927787544c5f12.diff

LOG: Add missing nullptr check.

While it's the plugin's moral duty to also set the error, this code
can't depend on that.

Added: 
    

Modified: 
    lldb/source/Expression/UserExpression.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp
index 93724af4322470b..e16a335d581a71b 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -255,7 +255,7 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx,
       target->GetUserExpressionForLanguage(expr, full_prefix, language,
                                            desired_type, options, ctx_obj,
                                            error));
-  if (error.Fail()) {
+  if (error.Fail() || !user_expression_sp) {
     LLDB_LOG(log, "== [UserExpression::Evaluate] Getting expression: {0} ==",
              error.AsCString());
     return lldb::eExpressionSetupError;


        


More information about the lldb-commits mailing list