Fix unused variable when NDEBUG is defined.

Occurs when compiling with:
  rm -rf build/ && make clean && make cmake CFLAGS='-DNDEBUG' && make
  ^--important
Merge #714 'Fix unused variable when NDEBUG is defined'