singpolyma / mnemonicode

Fork of http://web.archive.org/web/20101031205747/http://www.tothink.com/mnemonic/
MIT License
153 stars 20 forks source link

Fixed error handling in mn_decode() #2

Closed snej closed 7 years ago

snej commented 9 years ago

Fixed two bugs that kept mn_decode from reporting any errors:

  1. The error check for mn_next_word_index was inside the loop, not outside, so it never triggered.
  2. There was no check of the return value of the last mn_decode_word_index call, so no decoding errors were detected.
singpolyma commented 9 years ago

Thanks for this! That condition being inside the loop seems like a pretty big omission in the original...