mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-21 18:42:35 +01:00
Fix NPE when avatarUrl is empty
This commit is contained in:
parent
0ba73b11c1
commit
3738e30949
@ -1,6 +1,7 @@
|
|||||||
package org.schabi.newpipe.database.subscription;
|
package org.schabi.newpipe.database.subscription;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.room.ColumnInfo;
|
import androidx.room.ColumnInfo;
|
||||||
import androidx.room.Entity;
|
import androidx.room.Entity;
|
||||||
import androidx.room.Ignore;
|
import androidx.room.Ignore;
|
||||||
@ -95,11 +96,12 @@ public class SubscriptionEntity {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public String getAvatarUrl() {
|
public String getAvatarUrl() {
|
||||||
return avatarUrl;
|
return avatarUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAvatarUrl(final String avatarUrl) {
|
public void setAvatarUrl(@Nullable final String avatarUrl) {
|
||||||
this.avatarUrl = avatarUrl;
|
this.avatarUrl = avatarUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ data class FeedUpdateInfo(
|
|||||||
@NotificationMode
|
@NotificationMode
|
||||||
val notificationMode: Int,
|
val notificationMode: Int,
|
||||||
val name: String,
|
val name: String,
|
||||||
val avatarUrl: String,
|
val avatarUrl: String?,
|
||||||
val url: String,
|
val url: String,
|
||||||
val serviceId: Int,
|
val serviceId: Int,
|
||||||
// description and subscriberCount are null if the constructor info is from the fast feed method
|
// description and subscriberCount are null if the constructor info is from the fast feed method
|
||||||
|
@ -100,7 +100,9 @@ class SubscriptionManager(context: Context) {
|
|||||||
val subscriptionEntity = subscriptionTable.getSubscription(info.uid)
|
val subscriptionEntity = subscriptionTable.getSubscription(info.uid)
|
||||||
|
|
||||||
subscriptionEntity.name = info.name
|
subscriptionEntity.name = info.name
|
||||||
subscriptionEntity.avatarUrl = info.avatarUrl
|
|
||||||
|
// some services do not provide an avatar URL
|
||||||
|
info.avatarUrl?.let { subscriptionEntity.avatarUrl = it }
|
||||||
|
|
||||||
// these two fields are null if the feed info was fetched using the fast feed method
|
// these two fields are null if the feed info was fetched using the fast feed method
|
||||||
info.description?.let { subscriptionEntity.description = it }
|
info.description?.let { subscriptionEntity.description = it }
|
||||||
|
Loading…
Reference in New Issue
Block a user