Check the null value of UserAgent

This commit is contained in:
hikaruworld
2014-08-13 17:16:34 +09:00
committed by ymorika
parent 7b37d6b571
commit 08eb21844a
2 changed files with 3 additions and 1 deletions

View File

@@ -146,9 +146,11 @@ case class Context(settings: SystemSettingsService.SystemSettings, loginAccount:
val baseUrl = settings.baseUrl(request)
val host = new java.net.URL(baseUrl).getHost
val platform = request.getHeader("User-Agent") match {
case null => null
case agent if agent.contains("Mac") => "mac"
case agent if agent.contains("Linux") => "linux"
case agent if agent.contains("Win") => "windows"
case _ => null
}
/**