onewheelstudio / SirenixTutorialFiles

A collection of files used in recent (after Dec 19) Devdog Tutorial videos.
45 stars 24 forks source link

Missing null check during tree build #3

Open derek-knox opened 2 years ago

derek-knox commented 2 years ago

https://github.com/onewheelstudio/SirenixTutorialFiles/blob/8c1c96b8b0d5e45dadaf788f45bad05e61fb31e6/Data%20Manager/DataManager.cs#L30

Error when first opening the menu via 'Tools'. A simple null check resolved the issue (I additionally added a sort call as that's likely a default desire):

if (selectedType != null)
{
    tree.AddAllAssetsAtPath(selectedType.Name, "Assets/", selectedType, true, true);
    tree.SortMenuItemsByName(true);
}
onewheelstudio commented 2 years ago

Hmm. Wonder how we missed that one. Thanks. I've updated the code.