mirror of
https://github.com/KokaKiwi/BarInsta
synced 2025-11-20 21:06:32 +00:00
Null checks. Fixes https://github.com/austinhuang0131/barinsta/issues/905
This commit is contained in:
parent
c5d55f3661
commit
7dc9583e51
1 changed files with 2 additions and 0 deletions
|
|
@ -241,6 +241,7 @@ public class DirectThreadViewModel extends AndroidViewModel {
|
||||||
if (users != null && users.getValue() != null) {
|
if (users != null && users.getValue() != null) {
|
||||||
final List<User> userList = users.getValue();
|
final List<User> userList = users.getValue();
|
||||||
match = userList.stream()
|
match = userList.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
.filter(user -> user.getPk() == userId)
|
.filter(user -> user.getPk() == userId)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
@ -250,6 +251,7 @@ public class DirectThreadViewModel extends AndroidViewModel {
|
||||||
if (leftUsers != null && leftUsers.getValue() != null) {
|
if (leftUsers != null && leftUsers.getValue() != null) {
|
||||||
final List<User> userList = leftUsers.getValue();
|
final List<User> userList = leftUsers.getValue();
|
||||||
match = userList.stream()
|
match = userList.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
.filter(user -> user.getPk() == userId)
|
.filter(user -> user.getPk() == userId)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue