How to remove dead BMVerts from a list? I am trying to fix a bug in my script that happens in rare instances. I believe the bug occurs due to the very last thing the script is doing, which is:

bmesh.ops.remove_doubles(bm, verts=verts_to_weld, dist=0.001)


I think the problem is that verts_to_weld refers to a list of BMVerts that contains dead elements. This is because earlier in the script I use bmesh.ops.delete() to get rid of inner faces after using bmesh.ops.extrude_face_region(). So essentially my Remove Doubles is referring to some vertices that have been deleted earlier and don't exist in my bmesh anymore, but are still in the list. Is there a way to take the list verts_to_weld and remove any dead verts from that list? Thanks! Here's what my error looks like and also the print(verts_to_weld) at the bottom:
From the print output, it looks like the 'dead' vertices don't have any index associated with them. Did you try iterating through the list -  verts_to_weld -  and removing vertices with index == None? Or maybe print the index of all the vertices in the list and see what it is for dead vertices. Most likely it won't be an int.