From fc10d42ea93d8c41a0a3a668074b1303d051f744 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 27 Nov 2023 19:53:58 +0000 Subject: [PATCH] JAL-4238 minor errors fixed for JalviewJS structure colouring --- src/jalview/structure/StructureCommandsBase.java | 6 ++++-- src/jalview/structures/models/AAStructureBindingModel.java | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/jalview/structure/StructureCommandsBase.java b/src/jalview/structure/StructureCommandsBase.java index ec6032d..02efe70 100644 --- a/src/jalview/structure/StructureCommandsBase.java +++ b/src/jalview/structure/StructureCommandsBase.java @@ -26,8 +26,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import jalview.bin.Console; - /** * A base class holding methods useful to all classes that implement commands * for structure viewers @@ -133,6 +131,10 @@ public abstract class StructureCommandsBase implements StructureCommandsI public List colourBySequence( Map colourMap) { + if (colourMap == null) + { + return null; + } List commands = new ArrayList<>(); StringBuilder sb = new StringBuilder(colourMap.size() * 20); boolean first = true; diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index dc3cc1e..b984725 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -750,6 +750,10 @@ public abstract class AAStructureBindingModel /* * give up after 10 secs plus 1 sec per file */ + if (files == null) + { + return true; + } long starttime = System.currentTimeMillis(); long endTime = 10000 + 1000 * files.length + starttime; String notLoaded = null; @@ -1095,6 +1099,10 @@ public abstract class AAStructureBindingModel public List executeCommands(List commands, boolean getReply, String msg) { + if (commands == null) + { + return null; + } return executeCommand(getReply, msg, commands.toArray(new StructureCommandI[commands.size()])); } @@ -1350,6 +1358,10 @@ public abstract class AAStructureBindingModel AlignmentViewPanel viewPanel) { String[] files = getStructureFiles(); + if (files == null) + { + return null; + } SequenceRenderer sr = getSequenceRenderer(viewPanel); FeatureRenderer fr = viewPanel.getFeatureRenderer(); FeatureColourFinder finder = new FeatureColourFinder(fr); -- 1.7.10.2