Browse Source

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

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

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

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

Loading…
Cancel
Save