From 694a54d2f75661546a098f3c939501748ab22c31 Mon Sep 17 00:00:00 2001 From: Thomas BrĂ¼derli Date: Tue, 5 Jun 2012 08:43:58 +0000 Subject: Check objects before executing callback methods --- itjs/state.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'itjs') diff --git a/itjs/state.js b/itjs/state.js index e5e7c97..19f7438 100644 --- a/itjs/state.js +++ b/itjs/state.js @@ -82,7 +82,7 @@ restore_history: function() for (var i in this.it_restore_handlers) { - if (this.it_history_field.value || (this.it_restore_handlers[i].initial && (!idoc || !idoc.location.href.match(/s=/)))) + if ((this.it_history_field.value || (this.it_restore_handlers[i].initial && (!idoc || !idoc.location.href.match(/s=/)))) && this.it_restore_handlers[i].object) this.it_restore_handlers[i].object[this.it_restore_handlers[i].method](); } }, @@ -100,7 +100,8 @@ store_state: function() this.it_history_field = idoc ? idoc.getElementById('state') : {}; // Work-around IE5 not returning iframe document for (var i in this.it_store_handlers) - this.it_store_handlers[i].object[this.it_store_handlers[i].method](); + if (this.it_store_handlers[i].object) + this.it_store_handlers[i].object[this.it_store_handlers[i].method](); var ser = []; for (var key in this) -- cgit v1.2.3