gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master f243556 2/2: Crop prints warning and aborts ni


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master f243556 2/2: Crop prints warning and aborts nicely when catalog is empty
Date: Tue, 10 Jul 2018 18:26:43 -0400 (EDT)

branch: master
commit f24355651f9b85b7a9470295b80f3728cab606cc
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Crop prints warning and aborts nicely when catalog is empty
    
    In catalog mode, the Crop program accepts a catalog to make many crops in
    one command. However, when the catalog doesn't have any usable rows, it
    crashes (segmentation fault).
    
    Crop should print a warning and abort instead of an ugly segmentation
    fault. I am now busy implementing the fix.
    
    This bug was reported by Geoffry Krouchi.
    
    This fixes bug #54284.
---
 NEWS          | 1 +
 bin/crop/ui.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/NEWS b/NEWS
index b4c0010..ec8e18a 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,7 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   bug #54063: Match tests in make check fail randomly.
   bug #54186: MakeCatalog's --checkupperlimit not keeping output's name.
   bug #54188: MakeCatalog's Upperlimit not being sigma-clipped properly.
+  bug #54284: Crop segrault when catalog contains no data.
 
 
 
diff --git a/bin/crop/ui.c b/bin/crop/ui.c
index 2283fd9..ce6c83b 100644
--- a/bin/crop/ui.c
+++ b/bin/crop/ui.c
@@ -601,6 +601,10 @@ ui_read_cols(struct cropparams *p)
   /* Read the desired columns from the file. */
   cols=gal_table_read(p->catname, p->cathdu, colstrs, p->cp.searchin,
                       p->cp.ignorecase, p->cp.minmapsize, NULL);
+  if(cols==NULL)
+    error(EXIT_FAILURE, 0, "%s: is empty! No usable information "
+          "(un-commented lines) could be read from this file",
+          gal_fits_name_save_as_string(p->catname, p->cathdu));
 
 
   /* Set the number of objects (rows in each column). */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]