[Bf-blender-cvs] [2419ffa1837] master: Fix T90959: crash when hovering over empty data block socket

Jacques Lucke noreply at git.blender.org
Thu Aug 26 14:35:43 CEST 2021


Commit: 2419ffa183702044ff7e8b78fad8862ca313f12d
Author: Jacques Lucke
Date:   Thu Aug 26 14:35:10 2021 +0200
Branches: master
https://developer.blender.org/rB2419ffa183702044ff7e8b78fad8862ca313f12d

Fix T90959: crash when hovering over empty data block socket

===================================================================

M	source/blender/editors/space_node/node_draw.cc

===================================================================

diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index 3b1a55f55ab..b67117f1ad0 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -836,9 +836,8 @@ struct SocketTooltipData {
 static void create_inspection_string_for_generic_value(const geo_log::GenericValueLog &value_log,
                                                        std::stringstream &ss)
 {
-  auto id_to_inspection_string = [&](ID *id) {
-    ss << (id ? id->name + 2 : TIP_("None")) << " (" << BKE_idtype_idcode_to_name(GS(id->name))
-       << ")";
+  auto id_to_inspection_string = [&](ID *id, short idcode) {
+    ss << (id ? id->name + 2 : TIP_("None")) << " (" << BKE_idtype_idcode_to_name(idcode) << ")";
   };
 
   const GPointer value = value_log.value();
@@ -858,16 +857,16 @@ static void create_inspection_string_for_generic_value(const geo_log::GenericVal
     ss << *value.get<std::string>() << TIP_(" (String)");
   }
   else if (value.is_type<Object *>()) {
-    id_to_inspection_string((ID *)*value.get<Object *>());
+    id_to_inspection_string((ID *)*value.get<Object *>(), ID_OB);
   }
   else if (value.is_type<Material *>()) {
-    id_to_inspection_string((ID *)*value.get<Material *>());
+    id_to_inspection_string((ID *)*value.get<Material *>(), ID_MA);
   }
   else if (value.is_type<Tex *>()) {
-    id_to_inspection_string((ID *)*value.get<Tex *>());
+    id_to_inspection_string((ID *)*value.get<Tex *>(), ID_TE);
   }
   else if (value.is_type<Collection *>()) {
-    id_to_inspection_string((ID *)*value.get<Collection *>());
+    id_to_inspection_string((ID *)*value.get<Collection *>(), ID_GR);
   }
 }



More information about the Bf-blender-cvs mailing list