vendredi 31 janvier 2020

How to let if statement complete even if there is a NullPointerError

I have this if statement:

if (!this.updateTime.equals(ProductionBlocking
          .get(this.keyReader.getUpdateTime(this.config.configUuid.toString(),
              KeyType.PLUSSTAR)))) {
...
}

Sometimes the below is null so I get a NullPointerError.

ProductionBlocking
          .get(this.keyReader.getUpdateTime(this.config.configUuid.toString(),
              KeyType.PLUSSTAR))`

Is there any way I can let the program run on even if there is a null pointer? Basically in this case I'd like the if to determine they arent equal.

Aucun commentaire:

Enregistrer un commentaire