Fix response check NPE

Fix response check doens't take into account that body will be null
if response is not successfull.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-11-19 21:39:13 +01:00
parent 52545bc714
commit f2ce22ef08
1 changed files with 3 additions and 1 deletions

View File

@ -1462,7 +1462,9 @@ public class RESTMusicService implements MusicService
return;
}
if (response.body().getStatus() == SubsonicResponse.Status.ERROR &&
if (!response.isSuccessful()) {
throw new IOException("Server error, code: " + response.code());
} else if (response.body().getStatus() == SubsonicResponse.Status.ERROR &&
response.body().getError() != null) {
throw new IOException("Server error: " + response.body().getError().getCode());
} else {