Skip to content

Commit 7c76791

Browse files
committed
Handle null-safety error in FeedDao
The lastUpdated parameter can be null, adjust return types to signal that too Signed-off-by: Aayush Gupta <[email protected]>
1 parent 995a92b commit 7c76791

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

app/src/main/java/org/schabi/newpipe/database/feed/dao/FeedDAO.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ abstract class FeedDAO {
168168
ON fgs.subscription_id = lu.subscription_id AND fgs.group_id = :groupId
169169
"""
170170
)
171-
abstract fun oldestSubscriptionUpdate(groupId: Long): Flowable<List<OffsetDateTime>>
171+
abstract fun oldestSubscriptionUpdate(groupId: Long): Flowable<List<OffsetDateTime?>>
172172

173173
@Query("SELECT MIN(last_updated) FROM feed_last_updated")
174-
abstract fun oldestSubscriptionUpdateFromAll(): Flowable<List<OffsetDateTime>>
174+
abstract fun oldestSubscriptionUpdateFromAll(): Flowable<List<OffsetDateTime?>>
175175

176176
@Query("SELECT COUNT(*) FROM feed_last_updated WHERE last_updated IS NULL")
177177
abstract fun notLoadedCount(): Flowable<Long>

app/src/main/java/org/schabi/newpipe/local/feed/FeedDatabaseManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class FeedDatabaseManager(context: Context) {
177177
.observeOn(AndroidSchedulers.mainThread())
178178
}
179179

180-
fun oldestSubscriptionUpdate(groupId: Long): Flowable<List<OffsetDateTime>> {
180+
fun oldestSubscriptionUpdate(groupId: Long): Flowable<List<OffsetDateTime?>> {
181181
return when (groupId) {
182182
FeedGroupEntity.GROUP_ALL_ID -> feedTable.oldestSubscriptionUpdateFromAll()
183183
else -> feedTable.oldestSubscriptionUpdate(groupId)

app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class FeedViewModel(
6565
feedDatabaseManager.oldestSubscriptionUpdate(groupId),
6666

6767
Function6 { t1: FeedEventManager.Event, t2: Boolean, t3: Boolean, t4: Boolean,
68-
t5: Long, t6: List<OffsetDateTime> ->
68+
t5: Long, t6: List<OffsetDateTime?> ->
6969
return@Function6 CombineResultEventHolder(t1, t2, t3, t4, t5, t6.firstOrNull())
7070
}
7171
)

0 commit comments

Comments
 (0)