Bug in AddInputEntryAtEnd() ?

   1474   0   0
User Avatar
Member
6 posts
Joined: Jan. 2020
Offline
This code seems to be a bug to me:

https://github.com/sideeffects/HoudiniEngineForUnity/blob/01ad527fa9d1f3f7a65c347fa48727b7b6aeb749/Plugins/HoudiniEngineUnity/Scripts/Asset/HEU_InputNode.cs#L268-L279 [github.com]

AddInputEntryAtEnd() always return null.

This line will crash because it references to a null object:
https://github.com/sideeffects/HoudiniEngineForUnity/blob/01ad527fa9d1f3f7a65c347fa48727b7b6aeb749/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_ShelfTools.cs#L586 [github.com]

I realised it when I after a copy of the code in ExecuteToolOperatorSingle() and use it to pass GameObject to HDA. I'd like to know whether it's a bug or I've misunderstood the code.

The fix is trivial:
public HEU_InputObjectInfo AddInputEntryAtEnd(GameObject newEntryGameObject)
{
	if (_inputObjectType == InputObjectType.UNITY_MESH)
	{
		return InternalAddInputObjectAtEnd(newEntryGameObject);
	}
	else if (_inputObjectType == InputObjectType.HDA)
	{
		return InternalAddInputHDAAtEnd(newEntryGameObject);
	}
	return null;
}
Edited by tzuchien_chiu - Feb. 4, 2020 11:48:40
  • Quick Links