Added missing safety check for visual

Checked for pointer being a NULL pointer but actually had to check,
wheather the pointer pointed to a NULL pointer, before dereferncing it
twice.

(Confused visual info pointer with pointer to visual info pointer)
Fixed linked list removal in window code

Linked list removal did not work for the first element in the list.
Deleting the first window created and then continuing execution of the
application caused dangling pointer.