Fix T90959: crash when hovering over empty data block socket

This commit is contained in:
Jacques Lucke 2021-08-26 14:35:10 +02:00
parent da17692a3d
commit 2419ffa183
Notes: blender-bot 2023-02-13 17:50:12 +01:00
Referenced by issue #90959, crash on point instance socket mouse over
1 changed files with 6 additions and 7 deletions

View File

@ -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);
}
}