Skip to content

Commit

Permalink
Added some checks to prevent errors (sentry reported issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Mar 7, 2017
1 parent f8a8fcd commit f99375f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/client/javascript/core/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
this.__settings = {};
this.__windows = [];

if ( this.__scheme ) {
if ( this.__scheme && typeof this.__scheme.destroy === 'function' ) {
this.__scheme.destroy();
}
this.__scheme = null;
Expand Down
20 changes: 12 additions & 8 deletions src/client/javascript/core/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,19 @@
},

fullscreen: function(ev) {
var notif = OSjs.Core.getWindowManager().getNotificationIcon('_FullscreenNotification');
if ( notif ) {
if ( !document.fullScreen && !document.mozFullScreen && !document.webkitIsFullScreen && !document.msFullscreenElement ) {
notif.opts._isFullscreen = false;
notif.setImage(OSjs.API.getIcon('actions/gtk-fullscreen.png', '16x16'));
} else {
notif.opts._isFullscreen = true;
notif.setImage(OSjs.API.getIcon('actions/gtk-leave-fullscreen.png', '16x16'));
try {
var notif = OSjs.Core.getWindowManager().getNotificationIcon('_FullscreenNotification');
if ( notif ) {
if ( !document.fullScreen && !document.mozFullScreen && !document.webkitIsFullScreen && !document.msFullscreenElement ) {
notif.opts._isFullscreen = false;
notif.setImage(OSjs.API.getIcon('actions/gtk-fullscreen.png', '16x16'));
} else {
notif.opts._isFullscreen = true;
notif.setImage(OSjs.API.getIcon('actions/gtk-leave-fullscreen.png', '16x16'));
}
}
} catch ( e ) {
console.warn(e.stack, e);
}
},

Expand Down
8 changes: 5 additions & 3 deletions src/client/javascript/core/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
* @return {Mixed} Result (last) from bound function(s)
*/
Process.prototype._emit = function(k, args) {
return this.__evHandler.emit(k, args);
return this.__evHandler ? this.__evHandler.emit(k, args) : null;
};

/**
Expand All @@ -403,7 +403,7 @@
* @return {Number}
*/
Process.prototype._on = function(k, func) {
return this.__evHandler.on(k, func, this);
return this.__evHandler ? this.__evHandler.on(k, func, this) : null;
};

/**
Expand All @@ -418,7 +418,9 @@
* @param {Number} idx The hook index returned from _on()
*/
Process.prototype._off = function(k, idx) {
this.__evHandler.off(k, idx);
if ( this.__evHandler ) {
this.__evHandler.off(k, idx);
}
};

/**
Expand Down

0 comments on commit f99375f

Please sign in to comment.