summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2016-06-22 10:28:31 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2016-06-22 10:28:31 +0200
commit5553af504a38a7671fbba8ea2389de8852f82121 (patch)
treefd1df4a2349c4ae718d2871ffafdf4ccf19b2b2d
parent715038226f9209fde8192e1b04c3f2671a669eca (diff)
downloaduca-ufo-5553af504a38a7671fbba8ea2389de8852f82121.tar.gz
uca-ufo-5553af504a38a7671fbba8ea2389de8852f82121.tar.bz2
uca-ufo-5553af504a38a7671fbba8ea2389de8852f82121.tar.xz
uca-ufo-5553af504a38a7671fbba8ea2389de8852f82121.zip
Do not stop/close pcilib if we never had a handle
-rw-r--r--uca-ufo-camera.c10
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);
}