unifying: Do not allow closing a non-open device

This commit is contained in:
Richard Hughes 2017-06-26 17:17:01 +01:00
parent 38451999ff
commit f1399580b5

View File

@ -822,6 +822,10 @@ lu_device_close (LuDevice *device, GError **error)
g_return_val_if_fail (LU_IS_DEVICE (device), FALSE); g_return_val_if_fail (LU_IS_DEVICE (device), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* not open */
if (!lu_device_has_flag (device, LU_DEVICE_FLAG_IS_OPEN))
return TRUE;
/* subclassed */ /* subclassed */
g_debug ("closing device"); g_debug ("closing device");
if (klass->close != NULL) { if (klass->close != NULL) {