avoid npe for first time failed incoming attempts

pull/53/head
Zlatin Balevsky 2020-10-21 11:18:02 +01:00
parent dce69bbbbe
commit aeb392eba9
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 6 additions and 6 deletions

View File

@ -55,13 +55,13 @@ class H2HostCache extends HostCache {
protected synchronized void onConnection(Destination d, ConnectionAttemptStatus status) {
log.fine("onConnection ${d.toBase32()} status $status")
if (status == ConnectionAttemptStatus.SUCCESSFUL) {
if (uniqueHosts.add(d)) {
allHosts.add(d)
profiles.put(d, new HostMCProfile())
}
if (uniqueHosts.add(d)) {
allHosts.add(d)
profiles.put(d, new HostMCProfile())
}
if (status == ConnectionAttemptStatus.SUCCESSFUL)
profiles.get(d).successfulAttempt = true
}
int historyItems = profiles.get(d).hasHistory ? settings.hostProfileHistory : 1
// record into db