From 0fd1986d18c3093cc5386697ed49301599b74379 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Tue, 29 Sep 2015 11:46:54 +0100 Subject: [PATCH] JAL-1896 fixed NPE for RNA Helice without equivalent annotation --- src/jalview/appletgui/CutAndPasteTransfer.java | 5 ++++- src/jalview/gui/CutAndPasteTransfer.java | 5 ++++- src/jalview/io/FileLoader.java | 5 ++++- src/jalview/io/JSONFile.java | 7 +++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index 1ee8393..70a7319 100644 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -268,7 +268,10 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, af.getAlignViewport().setShowSequenceFeatures(showSeqFeatures); ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme( colourSchemeName, al); - af.changeColour(cs); + if (cs != null) + { + af.changeColour(cs); + } } else { diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index acc71f3..4541fc2 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -273,7 +273,10 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer af.getViewport().setFeaturesDisplayed(fd); ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme( colourSchemeName, al); - af.changeColour(cs); + if (cs != null) + { + af.changeColour(cs); + } } else { diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 9931f32..11c40c3 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -388,7 +388,10 @@ public class FileLoader implements Runnable alignFrame.getViewport().setFeaturesDisplayed(fd); ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme( colourSchemeName, al); - alignFrame.changeColour(cs); + if (cs != null) + { + alignFrame.changeColour(cs); + } } else { diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index 8725556..3ac4aa7 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -209,6 +209,13 @@ public class JSONFile extends AlignFile implements ComplexAlignFile jsonAlignmentPojo .setAlignAnnotation(annotationToJsonPojo(annotations)); } + else + { + if (globalColourScheme.equalsIgnoreCase("RNA Helices")) + { + jsonAlignmentPojo.setGlobalColorScheme("None"); + } + } if (exportSettings.isExportFeatures()) { -- 1.7.10.2