From 04cfb1edf19437d54f07b868bcf3cfc2a35fd3bc Mon Sep 17 00:00:00 2001 From: Mathias Guijarro Date: Wed, 2 Oct 2024 16:03:51 +0200 Subject: [PATCH] fix: prevent exception when empty string updates are coming from widget --- bec_widgets/widgets/figure/plots/waveform/waveform.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bec_widgets/widgets/figure/plots/waveform/waveform.py b/bec_widgets/widgets/figure/plots/waveform/waveform.py index 4b6571a7..4510ad72 100644 --- a/bec_widgets/widgets/figure/plots/waveform/waveform.py +++ b/bec_widgets/widgets/figure/plots/waveform/waveform.py @@ -467,6 +467,10 @@ class BECWaveform(BECPlotBase): - Custom signal name of device from BEC. x_entry(str): Entry of the x signal. """ + if not x_name: + # this can happen, if executed by a signal from a widget + return + curve_configs = self.config.curves curve_ids = list(curve_configs.keys()) curve_configs = list(curve_configs.values()) @@ -631,6 +635,13 @@ class BECWaveform(BECPlotBase): x_name = mode if mode is not None else "best_effort" self.x_axis_mode["name"] = x_name + if not x_name or not y_name: + # can happen if executed from a signal from a widget ; + # the code above has to be executed to set some other + # variables, but it cannot continue if both names are + # not set properly -> exit here + return + # 3. Check - Get entry if not provided and validate x_entry, y_entry, z_entry = self._validate_signal_entries( x_name, y_name, z_name, x_entry, y_entry, z_entry, validate_bec