diff --git a/CHANGES.md b/CHANGES.md index b0a100e9..b7076d2d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ # Rojo Change Log ## Current master -* *No changes* +* Fixed obscure error when syncing into an invalid service ## 0.4.9 (May 26, 2018) * Fixed warning when renaming or removing files that would sometimes corrupt the instance cache ([#72](https://github.com/LPGhatguy/rojo/pull/72)) diff --git a/plugin/src/Reconciler.lua b/plugin/src/Reconciler.lua index 327aa839..fd3ab6cf 100644 --- a/plugin/src/Reconciler.lua +++ b/plugin/src/Reconciler.lua @@ -192,12 +192,17 @@ function Reconciler:reconcileRoute(route, item, itemRoute) -- We should get services instead of making folders here. if rbx == game and not child then - local _ - _, child = pcall(game.GetService, game, piece) + local success + success, child = pcall(game.GetService, game, piece) + + -- That isn't a valid service! + if not success then + child = nil + end end -- We don't want to create a folder if we're reaching our target item! - if not child and i ~= #route then + if child == nil and i ~= #route then child = Instance.new("Folder") child.Parent = rbx child.Name = piece @@ -208,7 +213,7 @@ function Reconciler:reconcileRoute(route, item, itemRoute) end -- Let's check the route map! - if not rbx then + if rbx == nil then rbx = self._routeMap:get(itemRoute) end