From f3f49bdc8a3a6e0456fbf458e59186e63f78874a Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 21 Jan 2015 13:21:36 +0000 Subject: [PATCH] Safely handle command class being renamed --- Assets/Fungus/FungusScript/Editor/SequenceEditor.cs | 4 ++++ Assets/Fungus/FungusScript/Scripts/Sequence.cs | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs b/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs index 72b6ca52..d8629e70 100644 --- a/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs @@ -58,6 +58,10 @@ namespace Fungus // Make sure each command has a reference to its parent sequence foreach (Command command in sequence.commandList) { + if (command == null) // Will be deleted from the list later on + { + continue; + } command.parentSequence = sequence; } diff --git a/Assets/Fungus/FungusScript/Scripts/Sequence.cs b/Assets/Fungus/FungusScript/Scripts/Sequence.cs index 447e32ad..28b4ca86 100644 --- a/Assets/Fungus/FungusScript/Scripts/Sequence.cs +++ b/Assets/Fungus/FungusScript/Scripts/Sequence.cs @@ -61,6 +61,11 @@ namespace Fungus int index = 0; foreach (Command command in commandList) { + if (command == null) // Null entry will be deleted automatically later + { + continue; + } + command.commandIndex = index++; } }