X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FIdentified.java;h=659a56fb5b61e719ea08f98de85598e088cad530;hb=c4ae226ec5052116cefc542ae2017036a7bc6332;hp=f12f842a7938981a8ba07848dee9f77ff0abfa9f;hpb=f855be86d4d02a29c4603522c793a3b0eecc961c;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Identified.java b/src/main/java/net/pterodactylus/sone/data/Identified.java index f12f842..659a56f 100644 --- a/src/main/java/net/pterodactylus/sone/data/Identified.java +++ b/src/main/java/net/pterodactylus/sone/data/Identified.java @@ -1,5 +1,5 @@ /* - * Sone - Identified.java - Copyright © 2013 David Roden + * Sone - Identified.java - Copyright © 2013–2016 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,6 +17,8 @@ package net.pterodactylus.sone.data; +import javax.annotation.Nonnull; + import com.google.common.base.Function; import com.google.common.base.Optional; @@ -31,8 +33,9 @@ public interface Identified { public static final Function, Optional> GET_ID = new Function, Optional>() { @Override + @Nonnull public Optional apply(Optional identified) { - return identified.isPresent() ? Optional.of(identified.get().getId()) : Optional.absent(); + return (identified == null) ? Optional.absent() : (identified.isPresent() ? Optional.of(identified.get().getId()) : Optional.absent()); } };