Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Commit

Permalink
defaultVal being table fix
Browse files Browse the repository at this point in the history
If the ``defaultVal`` passed to ``Data:Get()`` is a table, we now return and save a copy of the table rather than the original.
  • Loading branch information
ThoughtSpinnr authored May 2, 2019
1 parent 0125e1c commit 8477ed0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ServerStorage/Aero/Modules/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ function Data:Get(key, defaultVal)
if (value == nil) then
success, value = self:_load(key)
if (success and value == nil and defaultVal ~= nil) then
value = defaultVal
self:Set(key, defaultVal)
value = typeof(defaultVal) ~= "table" and defaultVal or self.Shared.TableUtil.Copy(defaultVal)
self:Set(key, value)
end
end
return success, value
Expand Down

0 comments on commit 8477ed0

Please sign in to comment.