gcancellable: add back lost NULL check in g_cancellable_cancel()
Commit f975858e removed the NULL check in g_cancellable_cancel() by accident which makes it crash when called with NULL.
Add the check back and add a test so this doesn't happen again.
Fixes #1710 (closed)