diff --git a/code/__HELPERS/path.dm b/code/__HELPERS/path.dm index 08280617e97..09c1e882f4e 100644 --- a/code/__HELPERS/path.dm +++ b/code/__HELPERS/path.dm @@ -25,11 +25,11 @@ // We're guarenteed that list will be the first list in pathfinding_finished's argset because of how callback handles the arguments list var/datum/callback/await = CALLBACK(GLOBAL_PROC, /proc/pathfinding_finished, path) if(!SSpathfinder.pathfind(caller, end, max_distance, mintargetdist, id, simulated_only, exclude, skip_first, diagonal_safety, await)) - return null + return list() UNTIL(length(path)) - if(length(path) == 1 && path[1] == null) // It's trash, just hand back null to make it easy - return null + if(length(path) == 1 && path[1] == null || (QDELETED(caller) || QDELETED(end))) // It's trash, just hand back null to make it easy + return list() return path /// Uses funny pass by reference bullshit to take the path created by pathfinding, and insert it into a return list diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index cb18ffe6be6..337af357340 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -1039,7 +1039,7 @@ Pass a positive integer as an argument to override a bot's default speed. var/list/path_images = active_hud_list[DIAG_PATH_HUD] QDEL_LIST(path_images) - if(newpath) + if(length(newpath)) var/mutable_appearance/path_image = new /mutable_appearance() path_image.icon = path_image_icon path_image.icon_state = path_image_icon_state diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 16320948900..6b7484cbc4c 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -298,7 +298,6 @@ if(length(path) == 0) add_to_ignore(target) target = null - path = list() if(path.len > 0 && target) if(!bot_move(path[path.len])) diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 66462edc785..d0770841ab2 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -654,7 +654,7 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( item = I break if(item) - if(!get_path_to(src, item)) // WHY DO WE DISREGARD THE PATH AHHHHHH + if(!length(get_path_to(src, item))) // WHY DO WE DISREGARD THE PATH AHHHHHH item = null continue return item