Fix bug where updateNickSpeak would fail on lines without a prefix

This commit is contained in:
Lorenz Hübschle-Schneider 2014-05-03 14:12:55 +01:00
parent 6812501f12
commit 36a35628e2

View file

@ -92,6 +92,10 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
var updateNickSpeak = function(line) { var updateNickSpeak = function(line) {
// Try to find nick from prefix // Try to find nick from prefix
var prefix = line.prefix; var prefix = line.prefix;
if (prefix.length === 0) {
// some scripts produce lines without a prefix
return;
}
var nick = prefix[prefix.length - 1].text; var nick = prefix[prefix.length - 1].text;
// Action / me, find the nick as the first word of the message // Action / me, find the nick as the first word of the message
if (nick === " *") { if (nick === " *") {