usb: mtp: avoid empty description string

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Gerd Hoffmann 2014-04-25 12:06:47 +02:00
parent 2dc7fdf33d
commit 457d397a24
1 changed files with 1 additions and 1 deletions

View File

@ -1046,7 +1046,7 @@ static int usb_mtp_initfn(USBDevice *dev)
QTAILQ_INIT(&s->objects);
if (s->desc == NULL) {
s->desc = strrchr(s->root, '/');
if (s->desc) {
if (s->desc && s->desc[0]) {
s->desc = g_strdup(s->desc + 1);
} else {
s->desc = g_strdup("none");