From 694086eaef38b1b4ab3b8ccf6131b7cbbd9c1cf1 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 17 Jul 2012 11:09:35 +0300 Subject: [PATCH] fixed bug with uninitialized function in anyload --- client.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client.js b/client.js index ead16d28..4e1a98ab 100644 --- a/client.js +++ b/client.js @@ -588,13 +588,14 @@ CloudClient._anyload = function(pName,pSrc,pFunc,pStyle,pId,pElement) /* if passed arguments function * then it's onload by default */ - if(typeof pFunc === 'function'){ - element.onload=pFunc; - /* if object - then onload or onerror */ - }else if (typeof pFunc === 'object'){ - if(pFunc.onload)element.onload = pFunc.onload; - if(pFunc.onerror)element.onerror=pFunc.onerror; - } + if(pFunc) + if(typeof pFunc === 'function'){ + element.onload=pFunc; + /* if object - then onload or onerror */ + }else if (typeof pFunc === 'object'){ + if(pFunc.onload)element.onload = pFunc.onload; + if(pFunc.onerror)element.onerror=pFunc.onerror; + } if(arguments.length>=4){ element.style.cssText=pStyle; }