mirror of
https://github.com/britzl/monarch.git
synced 2025-06-27 10:27:49 +02:00
Fixed an error that appears when trying to delete an instance that is already deleted. (#109)
* Prevent deleting already removed instances. * Prehashed empty hash. * Use go.exists instead of pcall, when detecting non existing instances.
This commit is contained in:
parent
b78b896ada
commit
6ba3064749
@ -430,7 +430,9 @@ local function unload(screen, force)
|
|||||||
elseif screen.factory then
|
elseif screen.factory then
|
||||||
log("unload() factory", screen.id)
|
log("unload() factory", screen.id)
|
||||||
for id, instance in pairs(screen.factory_ids) do
|
for id, instance in pairs(screen.factory_ids) do
|
||||||
go.delete(instance)
|
if go.exists(instance) then
|
||||||
|
go.delete(instance)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
screen.factory_ids = nil
|
screen.factory_ids = nil
|
||||||
if screen.auto_preload and not force then
|
if screen.auto_preload and not force then
|
||||||
@ -1374,8 +1376,10 @@ function M.on_post(id, fn_or_url)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local empty_hash = hash("")
|
||||||
|
|
||||||
local function url_to_key(url)
|
local function url_to_key(url)
|
||||||
return (url.socket or hash("")) .. (url.path or hash("")) .. (url.fragment or hash(""))
|
return (url.socket or empty_hash) .. (url.path or empty_hash) .. (url.fragment or empty_hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user