Also, check buffer for NULL-ness before dereferencing it. https://bugzilla.gnome.org/show_bug.cgi?id=637824