fixed app crash (buffer overflow)
This commit is contained in:
@@ -58,7 +58,6 @@ class CalWeekFragment : Fragment() {
|
||||
super.onPageSelected(position)
|
||||
if (viewPager.isLaidOut) {
|
||||
Vars.selectedDay = position
|
||||
Log.d("debug", Vars.selectedDay.toString())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.odweta.solon
|
||||
|
||||
import android.util.Log
|
||||
import org.json.JSONObject
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
@@ -110,15 +111,17 @@ class Parsing {
|
||||
}
|
||||
|
||||
for (subj in subjectJSONList) {
|
||||
Log.d("debug", subj.toString())
|
||||
// for each subject in one particular day
|
||||
val subject = Subject()
|
||||
val kind = subj.getJSONObject("hourKind").get("id")
|
||||
val type = subj.getJSONObject("hourType").get("id")
|
||||
|
||||
if (
|
||||
(type == "SUPLOVANA") ||
|
||||
(type != "SUPLOVANI" && type != "ROZVRH")
|
||||
) {
|
||||
if (type == "SUPLOVANA") {
|
||||
continue
|
||||
}
|
||||
|
||||
if (type != "SUPLOVANI" && type != "ROZVRH") {
|
||||
when (kind) {
|
||||
"ZRUSENI_VYUKY_ROZVRH" -> {
|
||||
subject.name = subj.get("title").toString()
|
||||
@@ -232,14 +235,17 @@ class Parsing {
|
||||
} else {
|
||||
auxSubjects.add(subjects[i])
|
||||
|
||||
while ((auxSubjects[auxSubjects.size - 1].number.toInt() + 1).toString() != subjects[i + 1].number) {
|
||||
var previous = auxSubjects[auxSubjects.size - 1].number.toInt() + 1
|
||||
val next = subjects[i + 1].number.toInt()
|
||||
while (previous < next) {
|
||||
auxSubjects.add(
|
||||
Subject.freeSubject(
|
||||
(auxSubjects[auxSubjects.size - 1].number.toInt() + 1).toString(),
|
||||
"",
|
||||
""
|
||||
previous.toString(),
|
||||
subjects[i-1].end,
|
||||
subjects[i+1].start
|
||||
)
|
||||
)
|
||||
previous += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user