totpero/DeviceDetector.NET

Parse() crashes if userAgent is null

garychapman opened this issue · 0 comments

Not sure if this is a bug or by design, but the following code just threw a System.ArgumentNullException in our production system while processing a request where HTTP_USER_AGENT was not set:

var botParser = new BotParser();
botParser.SetUserAgent(HttpContext.Current.Request.UserAgent);
return null == botParser.Parse();

A simple workaround is to check if HttpContext.Current.Request.UserAgent is null, but I thought I'd raise this in case it actually is a bug.