fixed crashes when no network available
This commit is contained in:
parent
032cfda7ad
commit
3180a9c516
|
@ -415,7 +415,7 @@ abstract class ParcelableStatusesAdapter(
|
|||
var sum = 0
|
||||
for (i in 0 until itemCounts.size) {
|
||||
sum += when (i) {
|
||||
ITEM_INDEX_STATUS -> data!!.size
|
||||
ITEM_INDEX_STATUS -> data?.size ?: 0
|
||||
else -> itemCounts[i]
|
||||
}
|
||||
if (position < sum) {
|
||||
|
|
|
@ -167,7 +167,7 @@ abstract class ParcelableStatusesFragment : AbsStatusesFragment() {
|
|||
super.triggerRefresh()
|
||||
val accountKeys = accountKeys
|
||||
val statusStartIndex = adapter.statusStartIndex
|
||||
if (statusStartIndex >= 0) {
|
||||
if (statusStartIndex >= 0 && adapter.getStatusCount(true) > 0) {
|
||||
val firstStatus = adapter.getStatus(statusStartIndex, true)
|
||||
val sinceIds = Array(accountKeys.size) {
|
||||
return@Array if (firstStatus.account_key == accountKeys[it]) firstStatus.id else null
|
||||
|
|
|
@ -2018,14 +2018,14 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
if (childCount > 0) {
|
||||
if (isSmoothScrollbarEnabled) {
|
||||
var extent = childCount * 100
|
||||
var view = findViewByPosition(firstPosition)
|
||||
var view = findViewByPosition(firstPosition) ?: return 0
|
||||
val top = view.top
|
||||
var height = view.height
|
||||
if (height > 0) {
|
||||
extent += top * 100 / height
|
||||
}
|
||||
|
||||
view = findViewByPosition(lastPosition)
|
||||
view = findViewByPosition(lastPosition) ?: return 0
|
||||
val bottom = view.bottom
|
||||
height = view.height
|
||||
if (height > 0) {
|
||||
|
@ -2047,7 +2047,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
val skippedCount = skippedScrollItemCount
|
||||
if (firstPosition >= skippedCount && childCount > 0) {
|
||||
if (isSmoothScrollbarEnabled) {
|
||||
val view = findViewByPosition(firstPosition)
|
||||
val view = findViewByPosition(firstPosition) ?: return 0
|
||||
val top = view.top
|
||||
val height = view.height
|
||||
if (height > 0) {
|
||||
|
|
Loading…
Reference in New Issue