summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2020-01-02 10:13:09 +0200
committerTanu Kaskinen <tanuk@iki.fi>2020-01-02 10:18:21 +0200
commite30c1985edd72af7e32b8b23b82cb8bcfb886f79 (patch)
tree4a29a865c927ebf4e8187713c3d33ad9f02d2ac9
parent76524440a43b5efcf17f15066d7b4ef8ac4e2f0e (diff)
Fix ustring initialization from a NULL pointer
The packages vector was initialized from a and b, but b is sometimes NULL. Glib::ustring can't be initialized from a NULL pointer, so the initialization crashed. This bug was introduced by the dbus-glib to gdbus conversion in commit b8246d3f9b308770a49861cd2dea4d06cd88554e. Fixes: https://gitlab.freedesktop.org/pulseaudio/paprefs/issues/4
-rw-r--r--src/paprefs.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/paprefs.cc b/src/paprefs.cc
index af6d885..1c2c390 100644
--- a/src/paprefs.cc
+++ b/src/paprefs.cc
@@ -343,7 +343,10 @@ void MainWindow::showInstallButton(Gtk::Button *button, bool available) {
void MainWindow::installFiles(const char *a, const char *b = NULL) {
Glib::RefPtr<Gio::DBus::Proxy> proxy;
- const std::vector<Glib::ustring> packages = {a, b};
+ std::vector<Glib::ustring> packages = {a};
+
+ if (b)
+ packages.push_back(Glib::ustring(b));
proxy = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BusType::BUS_TYPE_SESSION,
"org.freedesktop.PackageKit",