State a necessary and sufficient condition for correcting an error using parity-check matrix decoding.