summaryrefslogtreecommitdiff
blob: 400fdd8596523a3e8b0b94ab9a6d9c8defc2f84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From a6ecc8855a0a2a8f76234f77422940b863960944 Mon Sep 17 00:00:00 2001
From: Antonio Rojas <arojas@archlinux.org>
Date: Sat, 2 Oct 2021 12:53:27 +0200
Subject: [PATCH] Fix kio-mtp with libmtp 1.1.19

In libmtp 1.1.19, an empty string is returned instead of NULL for devices without a deviceName, which breaks accessing those devices with kio-mtp
---
 mtp/kiod_module/mtpdevice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mtp/kiod_module/mtpdevice.cpp b/mtp/kiod_module/mtpdevice.cpp
index 8fe4abb2..f32cd1a4 100644
--- a/mtp/kiod_module/mtpdevice.cpp
+++ b/mtp/kiod_module/mtpdevice.cpp
@@ -40,7 +40,7 @@ MTPDevice::MTPDevice(const QString &dbusObjectPath, LIBMTP_mtpdevice_t *device,
     const char *deviceModel = LIBMTP_Get_Modelname(device);
 
     // prefer friendly devicename over model
-    if (!deviceName) {
+    if (!deviceName || strlen(deviceName) == 0) {
         m_friendlyName = QString::fromUtf8(deviceModel);
     } else {
         m_friendlyName = QString::fromUtf8(deviceName);
-- 
GitLab