From 5078a67d8357697791d2e71f9df95a46e762aa2e Mon Sep 17 00:00:00 2001 From: kiramt Date: Mon, 8 May 2017 09:23:31 +0100 Subject: [PATCH] JAL-2515 Id panel in applet updated for NPE on urlProvider --- src/jalview/appletgui/IdPanel.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index e47c50a..4cc4a3a 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -35,6 +35,7 @@ import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -225,6 +226,10 @@ public class IdPanel extends Panel implements MouseListener, String id = sq.getName(); // get the default url with the sequence details filled in + if (urlProvider == null) + { + return; + } String url = urlProvider.getPrimaryUrl(id); String target = urlProvider.getPrimaryTarget(id); try @@ -287,8 +292,15 @@ public class IdPanel extends Panel implements MouseListener, // build a new links menu based on the current links + any non-positional // features - List nlinks = urlProvider.getLinksForMenu(); - + List nlinks; + if (urlProvider != null) + { + nlinks = urlProvider.getLinksForMenu(); + } + else + { + nlinks = new ArrayList(); + } SequenceFeature sf[] = sq == null ? null : sq.getSequenceFeatures(); for (int sl = 0; sf != null && sl < sf.length; sl++) { -- 1.7.10.2