From 3de9f1eeb2b9a17eafcfe95a040872cfbdcafc54 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 13 Aug 2015 10:16:20 +0100 Subject: [PATCH] Ignore null commands in command list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commands typically become null in the command list when there’s been a change to a command script (e.g. upgrading to a new version of Fungus). It’s better to just ignore this rather than cause a null exception. --- Assets/Fungus/Flowchart/Scripts/Commands/If.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/If.cs b/Assets/Fungus/Flowchart/Scripts/Commands/If.cs index f0cfe755..19b03009 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/If.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/If.cs @@ -105,7 +105,12 @@ namespace Fungus for (int i = commandIndex + 1; i < parentBlock.commandList.Count; ++i) { Command nextCommand = parentBlock.commandList[i]; - + + if (nextCommand == null) + { + continue; + } + // Find next command at same indent level as this If command // Skip disabled commands, comments & labels if (!nextCommand.enabled ||