Weird behavior of USplineComponent

Hey together, I am playing around with the USplineComponent in c++.
Everything works really well and as expected, except the fact that the result has some strange behavior.

Here is a picture showing a cave moving along a spline.
The curly path is the expected result. But the second straight path should not be there.

Here are a few code snippets showing the calculation of the spline:

The USplineComponent is a DefaultSubobject of a UObject.
A FVector CurrentPos gets randomly calculated
(The random calculation is not the problem, it works fine without the spline)

And added to the spline like this:

// Add current point to path
PathSpline->AddSplinePoint(CurrentPos, ESplineCoordinateSpace::Local);

Then a Array is generated containing all points along spline in integer space

TArray<FIntVector> CavePath;
FIntVector LastPathPos = (FIntVector)PathSpline->GetLocationAtDistanceAlongSpline(0, ESplineCoordinateSpace::Local);
for (float PathPos = 0; PathPos < PathSpline->GetSplineLength(); PathPos++)
   FIntVector CurrentPathPos = (FIntVector)PathSpline->GetLocationAtDistanceAlongSpline(PathPos, ESplineCoordinateSpace::Local);
   if (CurrentPathPos != LastPathPos)
      LastPathPos = CurrentPathPos;

The CavePath array is then used to hollow out a cave
(The cave carving process works fine with another input so the problem must be the spline)

Maybe someone can help me. It’s the first time I am using the USplineComponent.