mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-17 22:02:16 +01:00
Fix volumemonitor test case
Don't blindly g_object_unref() that which may be NULL.
This commit is contained in:
@@ -16,10 +16,12 @@ do_mount_tests (GDrive *drive, GVolume *volume, GMount *mount)
|
|||||||
|
|
||||||
v = g_mount_get_volume (mount);
|
v = g_mount_get_volume (mount);
|
||||||
g_assert (v == volume);
|
g_assert (v == volume);
|
||||||
|
if (v != NULL)
|
||||||
g_object_unref (v);
|
g_object_unref (v);
|
||||||
|
|
||||||
d = g_mount_get_drive (mount);
|
d = g_mount_get_drive (mount);
|
||||||
g_assert (d == drive);
|
g_assert (d == drive);
|
||||||
|
if (d != NULL)
|
||||||
g_object_unref (d);
|
g_object_unref (d);
|
||||||
|
|
||||||
uuid = g_mount_get_uuid (mount);
|
uuid = g_mount_get_uuid (mount);
|
||||||
@@ -147,7 +149,10 @@ test_mounts (void)
|
|||||||
drive = g_mount_get_drive (mount);
|
drive = g_mount_get_drive (mount);
|
||||||
volume = g_mount_get_volume (mount);
|
volume = g_mount_get_volume (mount);
|
||||||
do_mount_tests (drive, volume, mount);
|
do_mount_tests (drive, volume, mount);
|
||||||
|
|
||||||
|
if (drive != NULL)
|
||||||
g_object_unref (drive);
|
g_object_unref (drive);
|
||||||
|
if (volume != NULL)
|
||||||
g_object_unref (volume);
|
g_object_unref (volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user