mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +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,6 +49,7 @@ do_volume_tests (GDrive *drive, GVolume *volume)
|
|||||||
|
|
||||||
d = g_volume_get_drive (volume);
|
d = g_volume_get_drive (volume);
|
||||||
g_assert (d == drive);
|
g_assert (d == drive);
|
||||||
|
if (d != NULL)
|
||||||
g_object_unref (d);
|
g_object_unref (d);
|
||||||
|
|
||||||
mount = g_volume_get_mount (volume);
|
mount = g_volume_get_mount (volume);
|
||||||
@ -126,6 +127,7 @@ test_volumes (void)
|
|||||||
|
|
||||||
drive = g_volume_get_drive (volume);
|
drive = g_volume_get_drive (volume);
|
||||||
do_volume_tests (drive, volume);
|
do_volume_tests (drive, volume);
|
||||||
|
if (drive != NULL)
|
||||||
g_object_unref (drive);
|
g_object_unref (drive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user