[gnome-builder/gnome-builder-43] libide/foundry: handle NULL more gracefully in warning messages



commit a175a17e0d7917c1789509aed8121b3f3e357633
Author: Christian Hergert <chergert redhat com>
Date:   Mon Sep 26 12:35:52 2022 -0700

    libide/foundry: handle NULL more gracefully in warning messages
    
    This just prevents a runtime critical w/ ide_runtime_get_id().

 src/libide/foundry/ide-runtime.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/foundry/ide-runtime.c b/src/libide/foundry/ide-runtime.c
index b7b1bafb9..ebf968201 100644
--- a/src/libide/foundry/ide-runtime.c
+++ b/src/libide/foundry/ide-runtime.c
@@ -721,6 +721,8 @@ ide_runtime_prepare_to_build (IdeRuntime    *self,
                               IdePipeline   *pipeline,
                               IdeRunContext *run_context)
 {
+  IdeRuntime *expected;
+
   IDE_ENTRY;
 
   g_return_if_fail (IDE_IS_RUNTIME (self));
@@ -740,10 +742,12 @@ ide_runtime_prepare_to_build (IdeRuntime    *self,
 
   g_return_if_fail (IDE_IS_PIPELINE (pipeline));
 
-  if (self != ide_pipeline_get_runtime (pipeline))
+  expected = ide_pipeline_get_runtime (pipeline);
+
+  if (self != expected)
     g_debug ("Preparing run context for build using non-native runtime. \"%s\" instead of \"%s\".",
              ide_runtime_get_id (self),
-             ide_runtime_get_id (ide_pipeline_get_runtime (pipeline)));
+             expected ? ide_runtime_get_id (expected) : "(null)");
 
   IDE_RUNTIME_GET_CLASS (self)->prepare_to_build (self, pipeline, run_context);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]