Up to Main Index                           Up to Journal for October, 2020

                    JOURNAL FOR SUNDAY 25TH OCTOBER, 2020
______________________________________________________________________________

SUBJECT: Fix for “Mysterious nil pointer fixed” fixed :(
   DATE: Sun 25 Oct 19:27:05 GMT 2020

I my haste to push out a fix for the mysterious nil pointer panic yesterday, I
broke clean-up and reset events :(

My original fix was simply to check if the actor’s location was nil and to
abort command processing. However, locations themselves are nowhere, and
always return nil when Locate.Where() is called. This is due to the fact that
locations are considered to be at the top of their Inventory chain.

For a clean-up or reset event the location is the actor, the actor’s where is
nil and the event does not get processed. Hrm…

There are a number of fixes for the simple check:


  if s.where == nil {
    return true
  }


I could check for the actor specifically having a Player attribute. I could
check to see if the actor had a Locate attribute. In the end I went with
specifically checking for not having an Exits attribute — as Exits are what
make a location a location:


  if s.where == nil && !attr.FindExits(s.actor).Found() {
    return true
  }


This seemed like the safest option. Fix is out on the public dev branch and
events are working again.

Only 6 days left to Halloween… /\oo/\

--
Diddymus


  Up to Main Index                           Up to Journal for October, 2020