Skip to content

Commit bc71d48

Browse files
committed
Fixed errors when a parameter is destroyed and it's reference is still used in the graph.
1 parent 9aa4290 commit bc71d48

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Assets/com.alelievr.NodeGraphProcessor/Runtime/Elements/ExposedParameter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void ISerializationCallbackReceiver.OnBeforeSerialize() {}
6868
protected virtual Settings CreateSettings() => new Settings();
6969

7070
public virtual object value { get; set; }
71-
public virtual Type GetValueType() => value.GetType();
71+
public virtual Type GetValueType() => value == null ? typeof(object) : value.GetType();
7272

7373
static Dictionary<Type, Type> exposedParameterTypeCache = new Dictionary<Type, Type>();
7474
internal ExposedParameter Migrate()

Assets/com.alelievr.NodeGraphProcessor/Runtime/Elements/ParameterNode.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ protected override void Process()
9797
parameter = graph.GetExposedParameterFromGUID(parameterGUID);
9898
#endif
9999

100+
ClearMessages();
101+
if (parameter == null)
102+
{
103+
AddMessage($"Parameter not found: {parameterGUID}", NodeMessageType.Error);
104+
return;
105+
}
106+
100107
if (accessor == ParameterAccessor.Get)
101108
output = parameter.value;
102109
else

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
- Fixed fields with [Settings] attribute not showing up with inheritance.
1111
- Fixed selection still active when selecting nodes without inspector fields.
1212
- Fixed multi-selection drag and drop of edges.
13+
- Fixed errors when a parameter is destroyed and it's reference is still used in the graph.
1314

1415
### Changed
1516
- Fields with both attributes [SerializeField] and [ShowInInspector] are now visible in both the node and inspector.

0 commit comments

Comments
 (0)