block: fix null-pointer bug on error case in block commit