mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix some crashes
This commit is contained in:
parent
813a2f4e12
commit
18106ebede
2 changed files with 2 additions and 2 deletions
|
@ -32,7 +32,7 @@ class RecyclerViewThreadLines(context: Context, private val lineInfoList: List<L
|
||||||
private val margin: Int = baseMargin * fontScale
|
private val margin: Int = baseMargin * fontScale
|
||||||
|
|
||||||
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
|
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
|
||||||
val position = (view.layoutParams as RecyclerView.LayoutParams).viewLayoutPosition
|
val position = parent.getChildAdapterPosition(view)
|
||||||
val level = lineInfoList[position].level
|
val level = lineInfoList[position].level
|
||||||
val startMargin = margin * level + margin * fontScale
|
val startMargin = margin * level + margin * fontScale
|
||||||
if (parent.layoutDirection == View.LAYOUT_DIRECTION_LTR) outRect.left = startMargin else outRect.right = startMargin
|
if (parent.layoutDirection == View.LAYOUT_DIRECTION_LTR) outRect.left = startMargin else outRect.right = startMargin
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class SpannableHelper {
|
||||||
if (matchEnd > content.toString().length()) {
|
if (matchEnd > content.toString().length()) {
|
||||||
matchEnd = content.toString().length();
|
matchEnd = content.toString().length();
|
||||||
}
|
}
|
||||||
if (content.toString().length() < matchEnd || matchStart < 0) {
|
if (content.toString().length() < matchEnd || matchStart < 0 || matchStart > matchEnd) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final String url = content.toString().substring(matchStart, matchEnd);
|
final String url = content.toString().substring(matchStart, matchEnd);
|
||||||
|
|
Loading…
Reference in a new issue