getNearbyDoor should be fixed to return a Ptr instead of the LiveCellRef. You can construct a Ptr if you have the LiveCellRef and the CellStore it belongs to:

            Ptr(MWWorld::LiveCellRefBase *liveCellRef=0, CellStore *cell=0)