Skip to content

Commit

Permalink
Merge pull request #622 from jtuttle/entityscroller-nil-pointer-safety
Browse files Browse the repository at this point in the history
skip EntityScroller update loop if target entity is nil
  • Loading branch information
Noofbiz authored Dec 12, 2018
2 parents c726982 + 7de32ae commit 3e00e3a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/camera.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ func (*EntityScroller) Remove(ecs.BasicEntity) {}
// Update moves the camera to the center of the space component.
// Values are automatically clamped to TrackingBounds by the camera.
func (c *EntityScroller) Update(dt float32) {
if c.SpaceComponent == nil {
return
}

width, height := c.SpaceComponent.Width, c.SpaceComponent.Height

pos := c.SpaceComponent.Position
Expand Down

0 comments on commit 3e00e3a

Please sign in to comment.