Add an assert guard to buffer_erase