Backport g_assert_null() and g_assert_nonnull()

These were added in newer GLibbversions, but upgrading requirements
just because of these would be an overkill.