Archiviert
13
0

Throw a more descriptive error of a packet type hasn't got a class.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2014-01-30 02:04:38 +01:00
Ursprung 6e3583b300
Commit 96cc518fb0

Datei anzeigen

@ -60,7 +60,12 @@ public class StructureCache {
*/
public static Object newPacket(PacketType type) {
try {
return PacketRegistry.getPacketClassFromType(type, true).newInstance();
Class<?> clazz = PacketRegistry.getPacketClassFromType(type, true);
// Check the return value
if (clazz != null)
return clazz.newInstance();
throw new IllegalArgumentException("Cannot find associated packet class: " + type);
} catch (InstantiationException e) {
return null;
} catch (IllegalAccessException e) {