For SAM files that have no alignments and when no reference is specified, contigInfo.getSequence() is null, causing an error when getSequenceName() is called on the resulting null pointer. Check for null instead and return that instead of barfing here.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@374 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
kiran 2009-04-13 00:48:21 +00:00
parent 5e96ab6161
commit 1fb16d54e0
1 changed files with 8 additions and 1 deletions

View File

@ -325,7 +325,14 @@ public class GenomeLoc implements Comparable<GenomeLoc> {
//
// Accessors and setters
//
public final String getContig() { return contigInfo.getSequence(this.contigIndex).getSequenceName(); }
public final String getContig() {
if (contigInfo != null && contigInfo.getSequence(this.contigIndex) != null) {
return contigInfo.getSequence(this.contigIndex).getSequenceName();
}
return null;
}
public final int getContigIndex() { return this.contigIndex; }
public final long getStart() { return this.start; }
public final long getStop() { return this.stop; }