summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2016-01-25 22:29:05 +0100
committerMarcus Meissner <marcus@jet.franken.de>2016-01-25 22:29:05 +0100
commit5942ea98a288acfdbd6b8d5d21fe22c8aa1ac6dd (patch)
treeac83a13272c894a17e2737d455f1021d6e823ebc
parentbce483b6ce984a56586964fa4183bb989befb0bc (diff)
downloadlibgphoto2-5942ea98a288acfdbd6b8d5d21fe22c8aa1ac6dd.tar.gz
check for return of the widget lookup
trying to fix https://github.com/gphoto/libgphoto2/issues/36
-rw-r--r--camlibs/pentax/library.c27
1 files 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;