diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 2a51befc411680acee9f42f63b02b4ff143c0811..e0f26df4906c26ba7042b8f9a9604f5a9265e2ba 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3015,11 +3015,16 @@ function gui_image_toggle_border(cid, tag, state) { // Switch the data for an existing svg image function gui_image_configure(cid, tag, image_key, tk_anchor) { var i = get_item(cid, tag); - i.setAttributeNS("http://www.w3.org/1999/xlink", "href", - "data:image/" + pd_cache.get(image_key).type + ";base64," + - pd_cache.get(image_key).data); - img_size_setter(cid, tag, pd_cache.get(image_key).type, - pd_cache.get(image_key).data, tk_anchor); + if (pd_cache.get(image_key)) { + i.setAttributeNS("http://www.w3.org/1999/xlink", "href", + "data:image/" + pd_cache.get(image_key).type + ";base64," + + pd_cache.get(image_key).data); + img_size_setter(cid, tag, pd_cache.get(image_key).type, + pd_cache.get(image_key).data, tk_anchor); + } else { + // need to change this to an actual error + post("image: error: can't find image"); + } } // Move an image