From 79cdbd3252740713c811eda77dce7841c28f1a95 Mon Sep 17 00:00:00 2001 From: Mark Kattenbelt Date: Thu, 23 Nov 2006 14:21:08 +0000 Subject: [PATCH] Fixed a bug where if you use the simulator with a model with a subset of variables of the models you previously used the simulator with, then it doesn't have an obscure crash. (For instance going from phil4 to phil3). git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@165 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- .../userinterface/simulator/GUISimulator.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/prism/src/userinterface/simulator/GUISimulator.java b/prism/src/userinterface/simulator/GUISimulator.java index 230cf9e4..82f1c9a3 100644 --- a/prism/src/userinterface/simulator/GUISimulator.java +++ b/prism/src/userinterface/simulator/GUISimulator.java @@ -341,21 +341,28 @@ public class GUISimulator extends GUIPlugin implements MouseListener, ListSelect boolean match = true; int i, n; n = defaultInitialState.getNumValues(); - for(i = 0; i < n; i++) + if (lastInitialState.getNumValues() != defaultInitialState.getNumValues()) { - if(!lastInitialState.contains(defaultInitialState.getName(i))) - { - match = false; - break; - } - else + match = false; + } + else + { + for(i = 0; i < n; i++) { - int index = lastInitialState.getIndexOf(defaultInitialState.getName(i)); - if(lastInitialState.getType(index) != defaultInitialState.getType(i)) + if(!lastInitialState.contains(defaultInitialState.getName(i))) { match = false; break; } + else + { + int index = lastInitialState.getIndexOf(defaultInitialState.getName(i)); + if(lastInitialState.getType(index) != defaultInitialState.getType(i)) + { + match = false; + break; + } + } } } if(!match) // if there's a problem, just use the default