Revit crashes when I modify a floor with a spline

Hello!

I’m coding a script to modify certain points of floors. Everything is OK but when a floor has a spline as a boundary the script fails and Revit crashes. Did anybody have the same issue? Thanks in advance.

Just in case, here is the code:

intersectorTodo = ReferenceIntersector(col1, FindReferenceTarget.All, vista3D)    
for suelo in suelos:
    	losa = suelo.SlabShapeEditor
    	array = losa.SlabShapeVertices
    	enumerador = array.GetEnumerator()
    	while enumerador.MoveNext():
    		vertice = enumerador.Current
    		puntoSuelo = vertice.Position
    		contextos = intersectorTodo.Find(puntoSuelo, direccion)
    		alturas = []
    		if contextos:
    			for contexto in contextos:
    				alturas.append(contexto.Proximity)
            alturas = sorted(alturas)
			losa.ModifySubElement(vertice, alturas[-1])

Captura de pantalla 2020-12-03 184523