kshyju / BrowserDetector

Fast & light weight browser detection & device detection for asp.net core and azure functions
MIT License
30 stars 13 forks source link

Should handle empty/null user-agent #8

Closed hakancunier closed 3 years ago

hakancunier commented 3 years ago

If the request is made by a HttpClient object, the "User-Agent" header is missing. Since there is no empty/null checking in BrowserDetector.GetBrowser method i get this error

System.IndexOutOfRangeException: Index was outside the bounds of the array. at Microsoft.Extensions.Primitives.StringValues.get_Item(Int32 index) at Shyjus.BrowserDetection.BrowserDetector.GetBrowser()

Can you please fix this?

kshyju commented 3 years ago

Apologies for the delayed response. This issue has been fixed in version 2.0.0. Could you use that please ? https://www.nuget.org/packages/Shyjus.BrowserDetector/2.0.0