From 601eac689798c1e7ea3bac253123f6576828f6a3 Mon Sep 17 00:00:00 2001 From: Martino di Filippo Date: Thu, 27 Jun 2013 19:41:01 +0200 Subject: [PATCH] Avoid exception when unable to match UA Make detect() return an empty object if it hasn't matched any known browser, so that graded browser support (and any external code using this library) doesn't raise a "Cannot read property ... of undefined" exception --- src/bowser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bowser.js b/src/bowser.js index 3b81fc5..0059b88 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -90,6 +90,7 @@ seamonkey: t , version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1] } + return {} } var bowser = detect()