mirror of
https://github.com/sbt/sbt.git
synced 2026-09-04 08:45:56 +02:00
Fix to issue #180 to handle null contentType
If the content type is null, the call for .toString on it will cause an NPE. This fixes this issue by wrapping the call in an Option, then mapping toString or falling back to null. getCharSetFromContentType handles null by returning ISO-8859-1
This commit is contained in:
@@ -51,7 +51,7 @@ class GigahorseUrlHandler extends AbstractURLHandler {
|
||||
|
||||
if (checkStatusCode(url, response)) {
|
||||
val bodyCharset =
|
||||
BasicURLHandler.getCharSetFromContentType(response.body().contentType().toString)
|
||||
BasicURLHandler.getCharSetFromContentType(Option(response.body().contentType()).map(_.toString).orNull)
|
||||
Some(
|
||||
new SbtUrlInfo(true,
|
||||
response.body().contentLength(),
|
||||
|
||||
Reference in New Issue
Block a user