forked from Limework/skript-db
Fix null pointer exception
This commit is contained in:
parent
d0191007a5
commit
3466a04ec8
@ -305,15 +305,17 @@ public class EffExecuteStatement extends Effect {
|
|||||||
private void setVariable(Event e, String name, Object obj) {
|
private void setVariable(Event e, String name, Object obj) {
|
||||||
|
|
||||||
//fix mediumblob and similar column types, so they return a String correctly
|
//fix mediumblob and similar column types, so they return a String correctly
|
||||||
if (obj.getClass().getName().equals("[B")) {
|
if (obj != null) {
|
||||||
obj = new String((byte[]) obj);
|
if (obj.getClass().getName().equals("[B")) {
|
||||||
|
obj = new String((byte[]) obj);
|
||||||
|
|
||||||
//in some servers instead of being byte array, it appears as SerialBlob (depends on mc version, 1.12.2 is bvte array, 1.16.5 SerialBlob)
|
//in some servers instead of being byte array, it appears as SerialBlob (depends on mc version, 1.12.2 is bvte array, 1.16.5 SerialBlob)
|
||||||
} else if (obj instanceof SerialBlob) {
|
} else if (obj instanceof SerialBlob) {
|
||||||
try {
|
try {
|
||||||
obj = new String(((SerialBlob) obj).getBinaryStream().readAllBytes());
|
obj = new String(((SerialBlob) obj).getBinaryStream().readAllBytes());
|
||||||
} catch (IOException | SerialException ex) {
|
} catch (IOException | SerialException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Variables.setVariable(name.toLowerCase(Locale.ENGLISH), obj, e, isLocal);
|
Variables.setVariable(name.toLowerCase(Locale.ENGLISH), obj, e, isLocal);
|
||||||
|
Loading…
Reference in New Issue
Block a user