From 7d35a50b20c166930d1ff8b42fb29b4c9c42c9b7 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sat, 21 Nov 2015 03:45:17 +0500 Subject: [PATCH] add check if target element exists to getAvatar() --- js/twister_io.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/twister_io.js b/js/twister_io.js index c4a0a4e..c8784ae 100644 --- a/js/twister_io.js +++ b/js/twister_io.js @@ -335,7 +335,11 @@ function _putResourceIntoStorage(locator, data) { } // get avatar and set it in img.attr("src") +// TODO rename to getAvatarImgToELem(), move nin theme related stuff to nin's theme_option.js function getAvatar( username, img ){ + if (!img.length) + return; + if (username === 'nobody') { img.attr('src', ($.Options.theme.val === 'nin') ? 'theme_nin/img/tornado_avatar.png' : 'img/tornado_avatar.png');