Do not attempt to show null values in inspector

This commit is contained in:
Yoshi Askharoun
2023-06-05 16:08:16 -05:00
parent b95b1fd624
commit a3d11e35cb
@@ -93,7 +93,10 @@ public class UIBDisassemblyViewModel : Document
InspectableObjectBuilder builder = new InspectableObjectBuilder()
.WithObjectProperties(instance, filter);
var valueProperty = TypeDescriptor.CreateProperty(typeof(InterpreterObject), "Value", instance.Value?.GetType());
var valueType = instance.Value?.GetType() ?? instance.Type;
if (valueType is not null)
{
PropertyDescriptor valueProperty = TypeDescriptor.CreateProperty(typeof(InterpreterObject), "Value", valueType);
IEditor editor = DefaultPropertyInspectors.CreateEditor(valueProperty);
if (editor is null)
{
@@ -108,6 +111,7 @@ public class UIBDisassemblyViewModel : Document
editor.BoundPropertyDescriptor = new BoundPropertyDescriptor(instance, valueProperty);
builder = builder.WithEditor(instance, i => i.Value, editor);
}
}
return builder.ToInspectableObject();
}