From a6aa729ca7fc9a6c446cb8a0c5bc32627b618e51 Mon Sep 17 00:00:00 2001 From: JackEAllen Date: Fri, 1 Nov 2024 10:39:40 +0000 Subject: [PATCH] Resolve pyright reportOptionalOperand --- mantidimaging/core/utility/histogram.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mantidimaging/core/utility/histogram.py b/mantidimaging/core/utility/histogram.py index 8caeb0345b0..0ed2b63a65c 100644 --- a/mantidimaging/core/utility/histogram.py +++ b/mantidimaging/core/utility/histogram.py @@ -17,7 +17,8 @@ def set_histogram_log_scale(histogram: HistogramLUTItem) -> None: :param histogram: The HistogramLUTItem of an image. """ x_data, y_data = histogram.plot.getData() - histogram.plot.setData(x_data, np.log(y_data + 1)) + if y_data is not None: + histogram.plot.setData(x_data, np.log(y_data + 1)) def generate_histogram_from_image(image_data: np.ndarray, num_bins: int = DEFAULT_NUM_BINS) -> tuple: