[gimp/gimp-2-10] app: fix gimp_hisotgram_n_components() for empty histograms



commit ed40f0763e21322a6049b1e035d34f39c06dc902
Author: Ell <ell_se yahoo com>
Date:   Tue Oct 22 16:08:01 2019 +0300

    app: fix gimp_hisotgram_n_components() for empty histograms
    
    (cherry picked from commit 8bd4ae34f5a919637b11e27162d210af62668971)

 app/core/gimphistogram.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimphistogram.c b/app/core/gimphistogram.c
index dbf8922865..50f49cf683 100644
--- a/app/core/gimphistogram.c
+++ b/app/core/gimphistogram.c
@@ -482,7 +482,10 @@ gimp_histogram_n_components (GimpHistogram *histogram)
 {
   g_return_val_if_fail (GIMP_IS_HISTOGRAM (histogram), 0);
 
-  return histogram->priv->n_channels - N_DERIVED_CHANNELS;
+  if (histogram->priv->n_channels > 0)
+    return histogram->priv->n_channels - N_DERIVED_CHANNELS;
+  else
+    return 0;
 }
 
 gint


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