Accessed none error even though I used isvalid node

In the error it says that SplineRef is the one you should be checking is valid not self, youre accessing Spline through the null SplineRef, hence Accessed None.