summaryrefslogtreecommitdiff
path: root/src/imlib.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-11-04 22:12:39 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-11-04 22:12:39 +0100
commitde185357e745f78e2133da826972502bd1980d1f (patch)
tree129cc1c51c888968aab6752f4639ce4e57b5535c /src/imlib.c
parent1c36c74c8ff5ad9768c854a2d88fa66fa9fe148f (diff)
Fix segfault when editing an image without info struct
Diffstat (limited to 'src/imlib.c')
-rw-r--r--src/imlib.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/imlib.c b/src/imlib.c
index a48d654..4270c4a 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -1213,8 +1213,12 @@ void feh_edit_inplace(winwidget w, int op)
else {
imlib_image_orientate(op);
tmp = w->im_w;
- FEH_FILE(w->file->data)->info->width = w->im_w = w->im_h;
- FEH_FILE(w->file->data)->info->height = w->im_h = tmp;
+ w->im_w = w->im_h;
+ w->im_h = tmp;
+ if (FEH_FILE(w->file->data)->info) {
+ FEH_FILE(w->file->data)->info->width = w->im_w;
+ FEH_FILE(w->file->data)->info->height = w->im_h;
+ }
}
winwidget_render_image(w, 1, 0);
return;
@@ -1257,8 +1261,12 @@ void feh_edit_inplace(winwidget w, int op)
else {
imlib_image_orientate(op);
tmp = w->im_w;
- FEH_FILE(w->file->data)->info->width = w->im_w = w->im_h;
- FEH_FILE(w->file->data)->info->height = w->im_h = tmp;
+ w->im_w = w->im_h;
+ w->im_h = tmp;
+ if (FEH_FILE(w->file->data)->info) {
+ FEH_FILE(w->file->data)->info->width = w->im_w;
+ FEH_FILE(w->file->data)->info->height = w->im_h;
+ }
}
im_weprintf(w, "unable to edit in place. Changes have not been saved.");
winwidget_render_image(w, 1, 0);