From e2e2296c089d11390c056e3525fc42487abcbe3f Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Wed, 9 Oct 2013 22:17:45 +0100 Subject: [PATCH] Fixed PD list, so that it doesn't crash when empty --- pv/mainwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 0e971ce0..ba232e25 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -305,14 +305,15 @@ void MainWindow::setup_add_decoders(QMenu *parent) { GSList *l = g_slist_sort(g_slist_copy( (GSList*)srd_decoder_list()), decoder_name_cmp); - do { + for(; l; l = l->next) + { QAction *const action = parent->addAction(QString( ((srd_decoder*)l->data)->name)); action->setData(qVariantFromValue(l->data)); _decoders_add_mapper.setMapping(action, action); connect(action, SIGNAL(triggered()), &_decoders_add_mapper, SLOT(map())); - } while ((l = l->next)); + } g_slist_free(l); } -- 2.30.2