]> sigrok.org Git - pulseview.git/commitdiff
trace: fix crash on empty channel name in popup form
authorDaniel Trnka <redacted>
Tue, 2 Jan 2024 21:13:54 +0000 (22:13 +0100)
committerSoeren Apel <redacted>
Fri, 26 Jan 2024 21:35:00 +0000 (22:35 +0100)
sr_dev_channel_name_set returns SR_ERR_ARG when a channel name is
empty and pulseview crashes once user deletes all characters from
a channel name in trace popup form.

This patch forbids to set empty channel name and keeps last non-empty
name provided by user.

pv/views/trace/trace.cpp

index 1f77598d609c04235dfb3d0e3282b693edf6ee32..ce935280abcf1f97e0adf485f580bf4b2da708be 100644 (file)
@@ -442,7 +442,8 @@ void Trace::on_popup_closed()
 void Trace::on_nameedit_changed(const QString &name)
 {
        /* This event handler notifies SignalBase that the name changed */
-       base_->set_name(name);
+       if(!name.isEmpty())
+               base_->set_name(name);
 }
 
 void Trace::on_coloredit_changed(const QColor &color)