Skip to content

Commit

Permalink
Fixed occasional crash on startup where the player pointer offset was…
Browse files Browse the repository at this point in the history
… outside of the game's readable memory
  • Loading branch information
squeek502 committed Dec 12, 2017
1 parent aefda1e commit fea6628
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion d2info/d2reader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ end

function D2Reader:getPlayerPointer()
if not self:checkStatus() then return end
local playerUnitPtr = uint32(self.process:read(self.base + self.offsets.player, 4))
local data, err = self.process:read(self.base + self.offsets.player, 4)
if not data then return nil, err end
local playerUnitPtr = uint32(data)
return playerUnitPtr ~= 0 and playerUnitPtr or nil
end

Expand Down

0 comments on commit fea6628

Please sign in to comment.