Browse code

Fix issue #164 checking that chrom list is not null

jotsetung authored on 17/05/2018 06:04:24
Showing 1 changed files

... ...
@@ -884,11 +884,16 @@ Rcpp::DataFrame RcppPwiz::getChromatogramHeaderInfo (Rcpp::IntegerVector whichCh
884 884
 Rcpp::DataFrame RcppPwiz::getAllChromatogramHeaderInfo ( ) {
885 885
   if (msd != NULL) {
886 886
     ChromatogramListPtr clp = msd->run.chromatogramListPtr;
887
+    if (clp.get() == 0) {
888
+      Rcpp::Rcerr << "The direct support for chromatogram info is only available in mzML format." << std::endl;
889
+      return Rcpp::DataFrame::create();
890
+    }
887 891
     int N = clp->size();
888
-    if (N > 0)
892
+    if (N > 0) {
889 893
       return getChromatogramHeaderInfo(Rcpp::seq(1, N));
890
-  } else {
891
-    Rprintf("Warning: pwiz not yet initialized.\n ");
894
+    } else {
895
+      Rprintf("Warning: pwiz not yet initialized.\n ");
896
+    }
892 897
   }
893 898
   return Rcpp::DataFrame::create( );
894 899
 }