Fix template nullpointer

This commit is contained in:
ME1312 2017-07-25 19:47:38 -04:00
parent c34b097676
commit f6274317d6
3 changed files with 4 additions and 11 deletions

Binary file not shown.

View File

@ -46,6 +46,10 @@ public class PacketExConfigureHost implements PacketIn, PacketOut {
@Override @Override
public void execute(JSONObject data) { public void execute(JSONObject data) {
host.host = new YAMLSection(data.getJSONObject("host")); host.host = new YAMLSection(data.getJSONObject("host"));
for (SubCreator.ServerTemplate template : host.templates.values()) {
Util.deleteDirectory(template.getDirectory());
}
host.templates.clear();
UniversalFile templates = new UniversalFile(host.runtime, "net:ME1312:SubServers:Host:Library:Files:Templates"); UniversalFile templates = new UniversalFile(host.runtime, "net:ME1312:SubServers:Host:Library:Files:Templates");
for (String name : data.getJSONObject("templates").keySet()) { for (String name : data.getJSONObject("templates").keySet()) {
try { try {

View File

@ -1,17 +1,10 @@
package net.ME1312.SubServers.Host.Network.Packet; package net.ME1312.SubServers.Host.Network.Packet;
import net.ME1312.SubServers.Host.Executable.SubCreator;
import net.ME1312.SubServers.Host.Library.Config.YAMLConfig;
import net.ME1312.SubServers.Host.Library.Config.YAMLSection;
import net.ME1312.SubServers.Host.Library.UniversalFile;
import net.ME1312.SubServers.Host.Library.Util;
import net.ME1312.SubServers.Host.Library.Version.Version; import net.ME1312.SubServers.Host.Library.Version.Version;
import net.ME1312.SubServers.Host.Network.PacketIn; import net.ME1312.SubServers.Host.Network.PacketIn;
import net.ME1312.SubServers.Host.ExHost; import net.ME1312.SubServers.Host.ExHost;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -48,10 +41,6 @@ public class PacketInReset implements PacketIn {
} catch (Exception e) { } catch (Exception e) {
host.log.error.println(e); host.log.error.println(e);
} }
for (SubCreator.ServerTemplate template : host.templates.values()) {
Util.deleteDirectory(template.getDirectory());
}
host.templates.clear();
} }
} }