blob/blobmsg: add null pointer checks to the *_for_each_attr functions, fix formatting