diff options
-rw-r--r-- | uca-ufo-camera.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/uca-ufo-camera.c b/uca-ufo-camera.c index eee1145..a5d5235 100644 --- a/uca-ufo-camera.c +++ b/uca-ufo-camera.c @@ -659,12 +659,14 @@ uca_ufo_camera_finalize(GObject *object) priv = UCA_UFO_CAMERA_GET_PRIVATE (object); - int err = pcilib_stop (priv->handle, PCILIB_EVENT_FLAGS_DEFAULT); - PCILIB_WARN_ON_ERROR (err); + if (priv->handle != NULL) { + int err = pcilib_stop (priv->handle, PCILIB_EVENT_FLAGS_DEFAULT); + PCILIB_WARN_ON_ERROR (err); - pcilib_close (priv->handle); - g_clear_error (&priv->construct_error); + pcilib_close (priv->handle); + } + g_clear_error (&priv->construct_error); G_OBJECT_CLASS (uca_ufo_camera_parent_class)->finalize (object); } |