From 5942ea98a288acfdbd6b8d5d21fe22c8aa1ac6dd Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 25 Jan 2016 22:29:05 +0100 Subject: check for return of the widget lookup trying to fix https://github.com/gphoto/libgphoto2/issues/36 --- camlibs/pentax/library.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/camlibs/pentax/library.c b/camlibs/pentax/library.c index c52991268..0eccedb41 100644 --- a/camlibs/pentax/library.c +++ b/camlibs/pentax/library.c @@ -581,15 +581,16 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context) static int camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) { - CameraWidget *w; - char *sval; - pslr_status status; + CameraWidget *w = NULL; + char *sval; + pslr_status status; + int ret; pslr_get_status(camera->pl, &status); GP_DEBUG ("*** camera_set_config"); - gp_widget_get_child_by_label (window, _("Image Size"), &w); - if (gp_widget_changed (w)) { + ret = gp_widget_get_child_by_label (window, _("Image Size"), &w); + if ((ret == GP_OK) && (gp_widget_changed (w))) { int i, resolution = -1; const char **valid_resolutions; @@ -610,8 +611,8 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) } } - gp_widget_get_child_by_label (window, _("Shooting Mode"), &w); - if (gp_widget_changed (w)) { + ret = gp_widget_get_child_by_label (window, _("Shooting Mode"), &w); + if ((ret == GP_OK) && gp_widget_changed (w)) { pslr_exposure_mode_t exposuremode; gp_widget_get_value (w, &sval); @@ -633,8 +634,8 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) gp_log (GP_LOG_ERROR, "pentax", "Could not decode exposuremode %s", sval); } - gp_widget_get_child_by_label (window, _("ISO"), &w); - if (gp_widget_changed (w)) { + ret = gp_widget_get_child_by_label (window, _("ISO"), &w); + if ((ret == GP_OK) && gp_widget_changed (w)) { int iso; gp_widget_get_value (w, &sval); if (sscanf(sval, "%d", &iso)) { @@ -660,8 +661,8 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) gp_log (GP_LOG_ERROR, "pentax", "Could not decode image quality %s", sval); } - gp_widget_get_child_by_label (window, _("Shutter Speed"), &w); - if (gp_widget_changed (w)) { + ret = gp_widget_get_child_by_label (window, _("Shutter Speed"), &w); + if ((ret == GP_OK) && gp_widget_changed (w)) { pslr_rational_t speed; gp_widget_get_value (w, &sval); @@ -681,8 +682,8 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context) /* parse more? */ } - gp_widget_get_child_by_label (window, _("Aperture"), &w); - if (gp_widget_changed (w)) { + ret = gp_widget_get_child_by_label (window, _("Aperture"), &w); + if ((ret == GP_OK) && gp_widget_changed (w)) { pslr_rational_t aperture; int apt1,apt2; -- cgit v1.2.1