From 137204dea15fd6ba35aec8c64f48e54bc2b776b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Wed, 28 May 2014 16:27:27 +0200 Subject: [PATCH] Retry setting primaries automatically, mainly to avoid confusion when creation was impossible due to lack of memory. --- .../assets/opencomputers/loot/OpenOS/boot/03_component.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/boot/03_component.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/boot/03_component.lua index 5e6739996..a4cccfa9d 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/boot/03_component.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/boot/03_component.lua @@ -27,6 +27,12 @@ end function component.isAvailable(componentType) checkArg(1, componentType, "string") + if not primaries[componentType] then + -- This is mostly to avoid out of memory errors preventing proxy + -- creation cause confusion by trying to create the proxy again, + -- causing the oom error to be thrown again. + component.setPrimary(componentType, component.list(componentType)()) + end return primaries[componentType] ~= nil end