3rd-Eden/useragent — Issue #5: Crash in useragent.match() call
Author: Niek
Created: 2011-10-19 08:09:52+00:00
State: open

I'm running version 1.01 and getting this crash occasionally:

```
/home/niek/node_modules/useragent/lib/useragent.js:117
if (ua = useragent.match(browsers[i].r)) {
^
TypeError: Cannot call method 'match' of undefined
at Function.parse (/home/niek/node_modules/useragent/lib/useragent.js:117:24)
at IncomingMessage. (/home/niek/myscript.js:34:26)
at IncomingMessage.emit (events.js:61:17)
at HTTPParser.onMessageComplete (http.js:133:23)
at Socket.ondata (http.js:1029:22)
at Socket._onReadable (net.js:677:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)
```

The code in question:
```var ua = useragent.parse(req.headers['user-agent']);```

Is this because req.headers['user-agent'] is undefined if no user-agent is included in the HTTP request?