gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master aac065a: Statistics: check if single-valued me


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master aac065a: Statistics: check if single-valued measurement options have a value
Date: Tue, 30 Apr 2019 08:53:03 -0400 (EDT)

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

    Statistics: check if single-valued measurement options have a value
    
    Until now, there was no check in statistics to see if single-valued options
    that need a value (like `--quantile') have one. This can cause
    unpredictable behavior and is not good. Statistics should complain and
    abort in such cases.
    
    With this commit a check has been added and Statistics will abort when it
    confronts such a case.
    
    This fixes bug #56246.
---
 NEWS                | 1 +
 bin/statistics/ui.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 6a99ad9..65a2f6f 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ See the end of the file for license conditions.
 
 ** Bugs fixed
   bug #56195: astscript-sort-by-night crashing because of AWK.
+  bug #56246: Single-valued measurement must abort with no value in Statistics.
 
 
 
diff --git a/bin/statistics/ui.c b/bin/statistics/ui.c
index 662c0df..df633ae 100644
--- a/bin/statistics/ui.c
+++ b/bin/statistics/ui.c
@@ -249,9 +249,11 @@ ui_add_to_single_value(struct argp_option *option, char 
*arg,
     {
       /* Read the string of numbers. */
       inputs=gal_options_parse_list_of_numbers(arg, filename, lineno);
-      d=inputs->array;
+      if(inputs->size==0)
+        error(EXIT_FAILURE, 0, "`--%s' needs a value", option->name);
 
       /* Do the appropriate operations with the  */
+      d=inputs->array;
       switch(option->key)
         {
         case UI_KEY_QUANTILE:



reply via email to

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