diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f5ca95..a4fb3062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased Changes * Fixed the Rojo plugin attempted to write the non-scriptable properties `Instance.SourceAssetId` and `HttpServer.HttpEnabled`. +* Fixed the Rojo plugin's handling of null referents. ## [6.0.0 Release Candidate 2](https://github.com/rojo-rbx/rojo/releases/tag/v6.0.0-rc.2) (November 19, 2020) * Fixed crash when malformed CSV files are put into a project. ([#310](https://github.com/rojo-rbx/rojo/issues/310)) diff --git a/plugin/src/Reconciler/decodeValue.lua b/plugin/src/Reconciler/decodeValue.lua index 3dfd321c..5962d210 100644 --- a/plugin/src/Reconciler/decodeValue.lua +++ b/plugin/src/Reconciler/decodeValue.lua @@ -9,6 +9,10 @@ local Error = require(script.Parent.Error) local function decodeValue(virtualValue, instanceMap) -- Refs are represented as IDs in the same space that Rojo's protocol uses. if virtualValue.Type == "Ref" then + if virtualValue.Value == nil then + return true, nil + end + local instance = instanceMap.fromIds[virtualValue.Value] if instance ~= nil then diff --git a/plugin/src/Reconciler/reify.lua b/plugin/src/Reconciler/reify.lua index 8fbee41b..b0c8aa0b 100644 --- a/plugin/src/Reconciler/reify.lua +++ b/plugin/src/Reconciler/reify.lua @@ -136,15 +136,21 @@ function applyDeferredRefs(instanceMap, deferredRefs, unappliedPatch) end for _, entry in ipairs(deferredRefs) do - local targetInstance = instanceMap.fromIds[entry.virtualValue.Value] + local virtualValue = entry.virtualValue + + if virtualValue.Value == nil then + continue + end + + local targetInstance = instanceMap.fromIds[virtualValue.Value] if targetInstance == nil then - markFailed(entry.id, entry.propertyName, entry.virtualValue) + markFailed(entry.id, entry.propertyName, virtualValue) continue end local ok = setProperty(entry.instance, entry.propertyName, targetInstance) if not ok then - markFailed(entry.id, entry.propertyName, entry.virtualValue) + markFailed(entry.id, entry.propertyName, virtualValue) end end end