Fix IE8 issue when icon is not defined

Sometimes no icon file is passed to replaceSVGIcon(), it showed an error
in IE8 and broke the code flow.

This fix adds a check whether the file name is set.
This commit is contained in:
Vincent Petry 2014-05-23 16:14:02 +02:00
parent 0879a63320
commit c9d05c66de
1 changed files with 1 additions and 1 deletions

View File

@ -1250,7 +1250,7 @@ OC.Util = {
* @return {string} fixed image path with png extension if SVG is not supported * @return {string} fixed image path with png extension if SVG is not supported
*/ */
replaceSVGIcon: function(file) { replaceSVGIcon: function(file) {
if (!OC.Util.hasSVGSupport()) { if (file && !OC.Util.hasSVGSupport()) {
var i = file.lastIndexOf('.svg'); var i = file.lastIndexOf('.svg');
if (i >= 0) { if (i >= 0) {
file = file.substr(0, i) + '.png' + file.substr(i+4); file = file.substr(0, i) + '.png' + file.substr(i+4);