Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent a Rhino crash when an old type is deserialised in the CreateCustomObject component #405

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Grasshopper_Engine/Query/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ public static partial class Query

public static Type Type(this IGH_Param param, Caller caller = null)
{
Type type;
if (param == null)
return typeof(object);
type = typeof(object);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one needs to stay a return as it doesn't belong to the same if-else chain as the rest.


if (param is Param_ScriptVariable)
return Type(((Param_ScriptVariable)param).TypeHint, param.Access);

type = Type(((Param_ScriptVariable)param).TypeHint, param.Access);
else if (caller != null)
return (caller.InputParams.Find(x => x.Name == param.NickName))?.DataType;

type = caller.InputParams.Find(x => x.Name == param.NickName)?.DataType;
else
return param.Type;
type = param.Type;

return type == null ? typeof(object) : type;
}

/***************************************************/
Expand Down