Fix: nullpointerexception

This commit is contained in:
Laurent Clouet
2020-01-12 14:37:30 +01:00
parent 99d717634b
commit 53663a6933
2 changed files with 13 additions and 7 deletions

View File

@@ -388,12 +388,14 @@ public class Client {
return 0;
}
if (this.server.getPage("logout").isEmpty() == false) {
try {
this.server.HTTPRequest(this.server.getPage("logout"));
}
catch (IOException e) {
// nothing to do: if the logout failed that's ok
}
}
this.server.interrupt();
try {
this.server.join();

View File

@@ -62,6 +62,7 @@ import com.sheepit.client.datamodel.FileMD5;
import com.sheepit.client.datamodel.HeartBeatInfos;
import com.sheepit.client.datamodel.JobInfos;
import com.sheepit.client.datamodel.JobValidation;
import com.sheepit.client.datamodel.RequestEndPoint;
import com.sheepit.client.datamodel.ServerConfig;
import lombok.Getter;
import org.simpleframework.xml.core.Persister;
@@ -769,7 +770,10 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
public String getPage(String key) {
if (this.serverConfig != null) {
return this.base_url + this.serverConfig.getRequestEndPoint(key).getPath();
RequestEndPoint endpoint = this.serverConfig.getRequestEndPoint(key);
if (endpoint != null) {
return this.base_url + endpoint.getPath();
}
}
return "";
}