diff options
author | Jens Georg <mail@jensge.org> | 2022-05-26 11:15:53 +0200 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2022-05-26 11:15:53 +0200 |
commit | 8b8666e120a49a054904a35b5b8ec7686c53e84d (patch) | |
tree | 3518af63543a77e0fde91b96622affa8fff18d21 /libgupnp | |
parent | dbbc405ec18d018a0ac45cb7f98774ad1e886166 (diff) | |
download | gupnp-8b8666e120a49a054904a35b5b8ec7686c53e84d.tar.gz |
device-info: Add null-check in icon lookup
Basically to satisfy scan-build...
Diffstat (limited to 'libgupnp')
-rw-r--r-- | libgupnp/gupnp-device-info.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c index 9f8623c..389281b 100644 --- a/libgupnp/gupnp-device-info.c +++ b/libgupnp/gupnp-device-info.c @@ -908,7 +908,7 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info, icon = l->data; /* Look between icons with positive weight first */ - if (icon->weight >= 0) { + if (icon && icon->weight >= 0) { if (!closest || icon->weight < closest->weight) closest = icon; } @@ -921,7 +921,8 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info, /* No icons with positive weight, look at ones with * negative weight */ - if (!closest || icon->weight > closest->weight) + if (!closest || + (icon && (icon->weight > closest->weight))) closest = icon; } } |