From 0a56d3e4a0d72b0eeef59118515bbafbddac011c Mon Sep 17 00:00:00 2001 From: Jason Barnabe Date: Mon, 9 Dec 2013 14:35:09 -0600 Subject: [PATCH] issue 78 Fix bug with unregistering --- components/stylishStyle.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/stylishStyle.js b/components/stylishStyle.js index 93b23fe..f442935 100644 --- a/components/stylishStyle.js +++ b/components/stylishStyle.js @@ -688,14 +688,14 @@ Style.prototype = { if (this.shouldUnregisterOnLoad()) { unregisterUrl = this.dataUrl; unregisterMethod = this.calculateRegistrationMethod(); - } - else { + } else if (this.appliedInfo == null) { + // not registered in the first place + return; + } else { unregisterUrl = this.appliedInfo[0]; unregisterMethod = this.appliedInfo[1]; } - if (unregisterUrl == null) { - return; - } + if (this.sss.sheetRegistered(unregisterUrl, unregisterMethod)) this.sss.unregisterSheet(unregisterUrl, unregisterMethod); // ignore unregistered styles if stylish isn't on