Browse Source

Fixed null error if there was a null entry in portrait list

master
chrisgregan 10 years ago
parent
commit
b2a24b263d
  1. 17
      Assets/Fungus/FungusScript/Editor/CommandEditor.cs

17
Assets/Fungus/FungusScript/Editor/CommandEditor.cs

@ -151,14 +151,17 @@ namespace Fungus
for (int i = 0; i < objectList.Count; ++i) for (int i = 0; i < objectList.Count; ++i)
{ {
string formattedName = ""; string formattedName = "";
if ( typeof(T).IsSubclassOf(typeof(MonoBehaviour)) == true ) if (objectList[i] != null)
{ {
formattedName = objectList[i].name; if ( typeof(T).IsSubclassOf(typeof(MonoBehaviour)) == true )
} {
else formattedName = objectList[i].name;
{ }
formattedName = objectList[i].ToString(); else
formattedName = formattedName.Substring(0, formattedName.LastIndexOf("(") - 1); {
formattedName = objectList[i].ToString();
formattedName = formattedName.Substring(0, formattedName.LastIndexOf("(") - 1);
}
} }
objectNames.Add(new GUIContent(formattedName)); objectNames.Add(new GUIContent(formattedName));

Loading…
Cancel
Save