Check the length of the response as the API can sometimes be incorrect

This commit is contained in:
Thinkofdeath 2014-04-09 20:44:07 +01:00
parent 5f03f206c3
commit 8a1c663032

View File

@ -1,4 +1,4 @@
From 2734342f54016d2ca4440bd07ed371a6458f5ccc Mon Sep 17 00:00:00 2001 From 91bdfad229c2a64a1308cb3733e11af2a88d6959 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com> From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Wed, 9 Apr 2014 13:29:57 +0100 Date: Wed, 9 Apr 2014 13:29:57 +0100
Subject: [PATCH] Convert player heads async Subject: [PATCH] Convert player heads async
@ -112,10 +112,10 @@ index b241cfe..925e017 100644
public Packet getUpdatePacket() { public Packet getUpdatePacket() {
diff --git a/src/main/java/org/spigotmc/HeadConverter.java b/src/main/java/org/spigotmc/HeadConverter.java diff --git a/src/main/java/org/spigotmc/HeadConverter.java b/src/main/java/org/spigotmc/HeadConverter.java
new file mode 100644 new file mode 100644
index 0000000..a284768 index 0000000..d84a862
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/HeadConverter.java +++ b/src/main/java/org/spigotmc/HeadConverter.java
@@ -0,0 +1,168 @@ @@ -0,0 +1,169 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import com.google.common.base.Charsets; +import com.google.common.base.Charsets;
@ -200,7 +200,8 @@ index 0000000..a284768
+ { + {
+ inputStreamReader.close(); + inputStreamReader.close();
+ } + }
+ if ( response.get( "size" ).getAsInt() != 1 ) + if ( response.get( "size" ).getAsInt() != 1 ||
+ response.getAsJsonArray( "profiles" ).size() != 1 )
+ { + {
+ return; + return;
+ } + }