I'm with doc here.
my guess is that the next line after your if line is causing the exception...
_________________________
!

download KiXnet