Return an empty URL when the icon name is invalid

issue7904
review70461002
This commit is contained in:
Nicolas Évrard
2019-06-04 17:38:17 +02:00
parent 07452ba2dc
commit ddef8d7c06
3 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -2762,7 +2762,7 @@
},
get_icon_url: function(icon_name) {
if (!icon_name) {
return;
return jQuery.when('');
}
return this.register_icon(icon_name).then(function() {
if (icon_name in this.loaded_icons) {
+5 -1
View File
@@ -865,7 +865,11 @@ function eval_pyson(value){
}
Sao.common.ICONFACTORY.get_icon_url(name)
.done(function(url) {
this.img.attr('src', url);
if (url) {
this.img.attr('src', url);
} else {
this.img.removeAttr('src');
}
}.bind(this));
}
});
+5 -1
View File
@@ -1570,7 +1570,11 @@
} else {
img_tag = cell;
}
img_tag.attr('src', url || '');
if (url) {
img_tag.attr('src', url);
} else {
img_tag.removeAttr('src');
}
}.bind(this));
} else {
value = this.attributes.string || '';