Skip to content
Permalink
Browse files

- fixed usage of uninitialized object in BlockLinesIterator

DBlockLinesIterator::check was used by FMultiBlockLinesIterator before it was constructed

https://forum.zdoom.org/viewtopic.php?t=66224
  • Loading branch information...
alexey-lysiuk committed Oct 26, 2019
1 parent dfecc12 commit fb384c6b8da01c54ec491a8e7dd778718187b7f7
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/scripting/vmiterators.cpp
@@ -92,24 +92,26 @@ DEFINE_ACTION_FUNCTION_NATIVE(DThinkerIterator, Reinit, ReinitThinker)
//
//===========================================================================

class DBlockLinesIterator : public DObject, public FMultiBlockLinesIterator
class DBlockLinesIterator : public DObject
{
DECLARE_ABSTRACT_CLASS(DBlockLinesIterator, DObject);
FPortalGroupArray check;

public:
FMultiBlockLinesIterator iterator;
FMultiBlockLinesIterator::CheckResult cres;


DBlockLinesIterator(AActor *actor, double checkradius)
: FMultiBlockLinesIterator(check, actor, checkradius)
: iterator(check, actor, checkradius)
{
cres.line = nullptr;
cres.Position.Zero();
cres.portalflags = 0;
}

DBlockLinesIterator(double x, double y, double z, double height, double radius, sector_t *sec)
:FMultiBlockLinesIterator(check, currentVMLevel, x, y, z, height, radius, sec)
: iterator(check, currentVMLevel, x, y, z, height, radius, sec)
{
cres.line = nullptr;
cres.Position.Zero();
@@ -151,7 +153,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DBlockLinesIterator, CreateFromPos, CreateBLIFromP

static int BLINext(DBlockLinesIterator *self)
{
return self->Next(&self->cres);
return self->iterator.Next(&self->cres);
}

DEFINE_ACTION_FUNCTION_NATIVE(DBlockLinesIterator, Next, BLINext)

0 comments on commit fb384c6

Please sign in to comment.
You can’t perform that action at this time.