Skip to content

Commit

Permalink
adding a warning when the image can't be located
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanueljourdan committed Aug 23, 2021
1 parent 789af14 commit f18d07b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions source/ui/uires/uires.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void uires_initclass();
t_uires *uires_new(t_symbol *s, short argc, t_atom *argv);
void uires_free(t_uires *x);
void uires_load_surfaces(t_uires *x);
t_jsurface * uires_load_surface_from_name(char *name);
t_jsurface * uires_load_surface_from_name(t_uires *, char *name);

void uires_setmouse(t_uires *x, long which);
void uires_mousedown(t_uires *x, t_object *patcherview, t_pt pt, long modifiers);
Expand Down Expand Up @@ -113,14 +113,14 @@ t_uires *uires_new(t_symbol *s, short argc, t_atom *argv)
void uires_load_surfaces(t_uires *x)
{
if (x->j_idrewitmyself == NULL) {
x->j_idrewitmyself = uires_load_surface_from_name("idrewitmyself.png");
x->j_idrewitmyself = uires_load_surface_from_name(x, "idrewitmyself.png");
}
if (x->j_idrewitmyselftongue == NULL) {
x->j_idrewitmyselftongue = uires_load_surface_from_name("idrewitmyselftongue.png");
x->j_idrewitmyselftongue = uires_load_surface_from_name(x, "idrewitmyselftongue.png");
}
}

t_jsurface * uires_load_surface_from_name(char *name)
t_jsurface * uires_load_surface_from_name(t_uires *x, char *name)
{
short path;
t_fourcc outtype;
Expand All @@ -131,6 +131,7 @@ t_jsurface * uires_load_surface_from_name(char *name)
// found the image, get the t_jsurface* from the file
return jgraphics_image_surface_create_from_file(filename, path);
} else {
object_warn((t_object *)x, "Couldn't locate image (%s)", name);
return NULL;
}
}
Expand Down

0 comments on commit f18d07b

Please sign in to comment.