Don't throw from getHighlight

This commit is contained in:
Cathy J. Fitzpatrick 2013-02-01 17:18:15 -07:00
parent 63f62b3991
commit 54c80f0247

View File

@ -1307,7 +1307,15 @@ function Lobby(id, elem) {
this.getHighlight = function (message) {
var highlights = Tools.prefs.get('highlights') || [];
if (!this.regex) {
this.regex = new RegExp('\\b('+highlights.join('|')+')\\b', 'gi');
try {
this.regex = new RegExp('\\b('+highlights.join('|')+')\\b', 'gi');
} catch (e) {
// If the expression above is not a regexp, we'll get here.
// Don't throw an exception because that would prevent the chat
// message from showing up, or, when the lobby is initialising,
// it will prevent the initialisation from completing.
return false;
}
}
return ((highlights.length > 0) && this.regex.test(message));
};