From 1f1342470b1b36d7897853e6f312cfcb62de8f33 Mon Sep 17 00:00:00 2001
From: Monika Komorowska <mk8@sanger.ac.uk>
Date: Wed, 27 Jul 2011 10:00:25 +0000
Subject: [PATCH] Added defined condition before using value in calculations

---
 misc-scripts/xref_mapping/XrefParser/BaseParser.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm
index f43ff6ff55..b828330cc8 100644
--- a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm
+++ b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm
@@ -1887,7 +1887,7 @@ sub add_xref {
   # If the description is more than 255 characters, chop it off and add
   # an indication that it has been truncated to the end of it.
 
-  if ( length($description) > 255 ) {
+  if (defined($description) && (length($description) > 255 ) ) {
     my $truncmsg = ' /.../';
     substr( $description, 255 - length($truncmsg),
             length($truncmsg), $truncmsg );
-- 
GitLab