From 5553af504a38a7671fbba8ea2389de8852f82121 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Wed, 22 Jun 2016 10:28:31 +0200 Subject: Do not stop/close pcilib if we never had a handle --- uca-ufo-camera.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'uca-ufo-camera.c') 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); } -- cgit v1.2.3