File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -417,9 +417,9 @@ public VisitDTO ProcessVisit(VisitDTO visit)
417417 // get geo info based on IP
418418 if ( ! string . IsNullOrEmpty ( visit . ip ) && visit . ip != "127.0.0.1" )
419419 {
420- using ( var objGeoIP2DB = new DatabaseReader ( string . Concat ( AppDomain . CurrentDomain . BaseDirectory , "App_Data \\ GeoIP2-City.mmdb" ) ) )
420+ try
421421 {
422- try
422+ using ( var objGeoIP2DB = new DatabaseReader ( string . Concat ( AppDomain . CurrentDomain . BaseDirectory , "App_Data \\ GeoIP2-City.mmdb" ) ) )
423423 {
424424 var objGeoIP2 = objGeoIP2DB . City ( visit . ip ) ;
425425
@@ -438,17 +438,17 @@ public VisitDTO ProcessVisit(VisitDTO visit)
438438 visit . latitude = objGeoIP2 . Location . Latitude . ToString ( ) ;
439439 visit . longitude = objGeoIP2 . Location . Longitude . ToString ( ) ;
440440 }
441- catch
442- {
443- // IP address cannot be resolved
444- }
441+ }
442+ catch
443+ {
444+ // IP address cannot be resolved
445445 }
446446 }
447447
448448 //get user agent properties using the 51Degrees database
449449 if ( ! string . IsNullOrEmpty ( visit . user_agent ) )
450450 {
451- var device = WebProvider . ActiveProvider . Match ( visit . user_agent ) ;
451+ var device = WebProvider . ActiveProvider ? . Match ( visit . user_agent ) ;
452452 if ( device != null )
453453 {
454454 if ( device [ "IsMobile" ] != null && device [ "IsMobile" ] . ToString ( ) == "True" )
You can’t perform that action at this time.
0 commit comments