forked from Qortal/qortal
Fix potential NPE when trying to obtain opportunistic database connection.
Could have affected: Controller.deleteExpiredTransactions() Network.getConnectablePeer() Network.opportunisticMergePeers() Network.prunePeers() Symptoms: 2021-02-12 16:46:06 WARN NetworkProcessor:152 - [1556] exception while trying to produce task java.lang.NullPointerException: null at org.qortal.repository.hsqldb.HSQLDBRepository.<init>(HSQLDBRepository.java:92) ~[qortal.jar:1.4.1] at org.qortal.repository.hsqldb.HSQLDBRepositoryFactory.tryRepository(HSQLDBRepositoryFactory.java:97) ~[qortal.jar:1.4.1] at org.qortal.repository.RepositoryManager.tryRepository(RepositoryManager.java:33) ~[qortal.jar:1.4.1] at org.qortal.network.Network.getConnectablePeer(Network.java:525) ~[qortal.jar:1.4.1]
This commit is contained in:
parent
6cd86d86a6
commit
eb23940996
@ -94,7 +94,11 @@ public class HSQLDBRepositoryFactory implements RepositoryFactory {
|
||||
@Override
|
||||
public Repository tryRepository() throws DataException {
|
||||
try {
|
||||
return new HSQLDBRepository(this.tryConnection());
|
||||
Connection connection = this.tryConnection();
|
||||
if (connection == null)
|
||||
return null;
|
||||
|
||||
return new HSQLDBRepository(connection);
|
||||
} catch (SQLException e) {
|
||||
throw new DataException("Repository instantiation error", e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user