fix tsched crashing when a process gets removed

when a process removes another process, the amount of processes tsched
has decrements, but the for loop doesn't update. a check has been
implemented to check for when the task that's getting looked up doesn't
exist.
This commit is contained in:
Ponali
2025-10-04 18:36:57 +02:00
parent db01a8d741
commit d63941814f
2 changed files with 124 additions and 126 deletions
+3 -1
View File
@@ -105,7 +105,9 @@ local function runTasks()
if not result then if not result then
handleError(errorMessage) handleError(errorMessage)
end end
if coroutine.status(tsched.tasks[i].task) == "dead" then if not tsched.tasks[i] then
log.kernel.warn("Attempted to update a non-existent task. This is likely because it was removed.")
elseif coroutine.status(tsched.tasks[i].task) == "dead" then
_PUBLIC.tsched.removeTask(tsched.tasks[i].id) _PUBLIC.tsched.removeTask(tsched.tasks[i].id)
--ocelot.log("Removed coroutine") --ocelot.log("Removed coroutine")
i = i - 1 i = i - 1
-4
View File
@@ -1,4 +0,0 @@
[00:00:04:12] Debug!
[00:00:04:19] Info!
[00:00:04:25] Warning!
[00:00:04:32] Error!