SteamWar/SpigotCore
Archiviert
13
0

Fixing potential NullPointerException and schematic deletion #22

Zusammengeführt
Lixfel hat 2 Commits von NPEFix nach master 2019-12-27 17:59:12 +01:00 zusammengeführt
2 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -35,8 +35,8 @@
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>FAWE</artifactId>
<version>1.14</version>
<artifactId>WorldEdit</artifactId>
<version>1.15</version>
<scope>provided</scope>
</dependency>
<dependency>

Datei anzeigen

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -158,7 +159,10 @@ public class Schematic {
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = " + schemID);
try {
rs.next();
InputStream is = rs.getBlob("SchemData").getBinaryStream();
Blob schemData = rs.getBlob("SchemData");
if(schemData == null)
throw new IOException("SchemData is null");
InputStream is = schemData.getBinaryStream();
switch(Core.getVersion()){
case 8:
return Schematic_8.getClipboard(is);
@ -255,8 +259,8 @@ public class Schematic {
}
public void remove(){
SQL.update("DELETE FROM Schematic WHERE SchemOwner = " + schemOwner + " AND SchemName = '" + schemName + "'");
SQL.update("DELETE FROM SchemMember WHERE SchemOwner = " + schemOwner + " AND SchemName = '" + schemName + "'");
SQL.update("DELETE FROM Schematic WHERE SchemOwner = " + schemOwner + " AND SchemName = '" + schemName + "'");
}
public static class WrongVersionException extends Exception{}