Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Kampfkarren committed Aug 15, 2019
1 parent 8658e1f commit 0896309
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions DataStore2/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ end

function DataStore:_GetRaw()
if not self.getQueue then
self.getQueue = {}
self.getQueue = Instance.new("BindableEvent")
end

if self.getting then
self:Debug("A _GetRaw is already in motion, just wait until it's done")
local event = Instance.new("BindableEvent")
self.getQueue[#self.getQueue + 1] = event
event.Event:wait()
self.getQueue.Event:wait()
self:Debug("Aaand we're back")
return
end
Expand All @@ -83,12 +81,9 @@ function DataStore:_GetRaw()

self.value = value

for _, waiting in pairs(self.getQueue) do
self:Debug("resuming in queue", waiting)
waiting:Fire()
end
self:Debug("value received")
self.getQueue:Fire()

self.getQueue = {}
self.haveValue = true
end

Expand Down
2 changes: 1 addition & 1 deletion Tests/tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ habitat:loadFromFs("../DataStore2").Parent = Modules

for name in lfs.dir("..") do
local realName = name:match("(.+)%.module%.lua$")
if realName then
if realName and realName ~= "DataStore2" then
local file = habitat:loadFromFs("../" .. name)
file.Name = realName
file.Parent = Modules
Expand Down

0 comments on commit 0896309

Please sign in to comment.