Merge pull request #248 from lorenzhs/fixnull
Don't modify buffer in document visibility change handler if not connected
This commit is contained in:
commit
5d2bb70e26
|
@ -582,11 +582,14 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
// We just switched back to the glowing-bear window and unread messages may have
|
// We just switched back to the glowing-bear window and unread messages may have
|
||||||
// accumulated in the active buffer while the window was in the background
|
// accumulated in the active buffer while the window was in the background
|
||||||
var buffer = models.getActiveBuffer();
|
var buffer = models.getActiveBuffer();
|
||||||
buffer.unread = 0;
|
// This can also be triggered before connecting to the relay, check for null (not undefined!)
|
||||||
buffer.notification = 0;
|
if (buffer !== null) {
|
||||||
|
buffer.unread = 0;
|
||||||
|
buffer.notification = 0;
|
||||||
|
|
||||||
// Trigger title and favico update
|
// Trigger title and favico update
|
||||||
$rootScope.$emit('notificationChanged');
|
$rootScope.$emit('notificationChanged');
|
||||||
|
}
|
||||||
|
|
||||||
// the unread badge in the bufferlist doesn't update if we don't do this
|
// the unread badge in the bufferlist doesn't update if we don't do this
|
||||||
$rootScope.$apply();
|
$rootScope.$apply();
|
||||||
|
|
Loading…
Reference in New Issue