Skip to content

Commit

Permalink
fix calendar crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ekibun committed Dec 22, 2019
1 parent d458ae7 commit ec85074
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ class CalendarPagerAdapter(private val view: ViewGroup) : androidx.viewpager.wid
mStrBuilder.setLength(0)
val time = mFormatter.format("%02d:%02d", if (use30h) (hour - 6 + 24) % 24 + 6 else (hour + 24) % 24, minute % 60).toString()
val cal = Calendar.getInstance()
cal.time = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(it.airdate ?: "") ?: cal.time
cal.time = try {
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(it.airdate ?: "")
} catch (e: Exception) {
null
} ?: cal.time
val week = (if ((subject.timeJP?.toIntOrNull()
?: 0) / 100 < 5) 1 else 0) + if (!useCN || subject.timeCN.isNullOrEmpty()) 0 else
Math.min(if (subject.timeCN.toIntOrNull() ?: 0 < subject.timeJP?.toIntOrNull() ?: 0) 1 else 0, when (((subject.weekDayCN
Expand Down

0 comments on commit ec85074

Please sign in to comment.