[gimp] app: fix gimp_hisotgram_n_components() for empty histograms



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

    app: fix gimp_hisotgram_n_components() for empty histograms

 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 dce15e61cf..a5012f6b02 100644
--- a/app/core/gimphistogram.c
+++ b/app/core/gimphistogram.c
@@ -483,7 +483,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]