mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
volume monitor: don't unref NULL
Fix a couple more cases of blindly calling g_object_unref() on the result of a function that is documented as sometimes returning NULL.
This commit is contained in:
parent
a7662ef315
commit
1612a4d506
@ -49,7 +49,8 @@ do_volume_tests (GDrive *drive, GVolume *volume)
|
||||
|
||||
d = g_volume_get_drive (volume);
|
||||
g_assert (d == drive);
|
||||
g_object_unref (d);
|
||||
if (d != NULL)
|
||||
g_object_unref (d);
|
||||
|
||||
mount = g_volume_get_mount (volume);
|
||||
if (mount != NULL)
|
||||
@ -126,7 +127,8 @@ test_volumes (void)
|
||||
|
||||
drive = g_volume_get_drive (volume);
|
||||
do_volume_tests (drive, volume);
|
||||
g_object_unref (drive);
|
||||
if (drive != NULL)
|
||||
g_object_unref (drive);
|
||||
}
|
||||
|
||||
g_list_foreach (volumes, (GFunc)g_object_unref, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user