diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/DefaultValueLiveData.java b/app/src/main/java/org/thoughtcrime/securesms/util/DefaultValueLiveData.java index 2fe907f0ff..7c91e19223 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/DefaultValueLiveData.java +++ b/app/src/main/java/org/thoughtcrime/securesms/util/DefaultValueLiveData.java @@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.util; import androidx.annotation.NonNull; import androidx.lifecycle.MutableLiveData; +import org.whispersystems.libsignal.util.guava.Preconditions; + /** * Helps prevent all the @Nullable warnings when working with LiveData. */ @@ -15,6 +17,18 @@ public class DefaultValueLiveData extends MutableLiveData { this.defaultValue = defaultValue; } + @Override + public void postValue(@NonNull T value) { + Preconditions.checkNotNull(value); + super.postValue(value); + } + + @Override + public void setValue(@NonNull T value) { + Preconditions.checkNotNull(value); + super.setValue(value); + } + @Override public @NonNull T getValue() { T value = super.getValue();