diff --git a/applications/nfc/helpers/nfc_mf_classic_dict.c b/applications/nfc/helpers/nfc_mf_classic_dict.c index c9c6e991..e9cfff39 100644 --- a/applications/nfc/helpers/nfc_mf_classic_dict.c +++ b/applications/nfc/helpers/nfc_mf_classic_dict.c @@ -32,7 +32,7 @@ bool nfc_mf_classic_dict_get_next_key(Stream* stream, uint64_t* key) { bool next_key_read = false; while(!next_key_read) { - if(stream_read_line(stream, next_line)) break; + if(!stream_read_line(stream, next_line)) break; if(string_get_char(next_line, 0) == '#') continue; if(string_size(next_line) != NFC_MF_CLASSIC_KEY_LEN) continue; for(uint8_t i = 0; i < 12; i += 2) { diff --git a/lib/toolbox/stream/stream.c b/lib/toolbox/stream/stream.c index dc1b0b2b..4aee8acd 100644 --- a/lib/toolbox/stream/stream.c +++ b/lib/toolbox/stream/stream.c @@ -99,7 +99,7 @@ bool stream_read_line(Stream* stream, string_t str_result) { } } while(true); - return stream_eof(stream); + return string_size(str_result) != 0; } bool stream_rewind(Stream* stream) { diff --git a/lib/toolbox/stream/stream.h b/lib/toolbox/stream/stream.h index 3053314e..97ded8bd 100644 --- a/lib/toolbox/stream/stream.h +++ b/lib/toolbox/stream/stream.h @@ -102,8 +102,8 @@ bool stream_delete_and_insert( * Read line from a stream (supports LF and CRLF line endings) * @param stream * @param str_result - * @return true if line was read - * @return false if EOF + * @return true if line lenght is not zero + * @return false otherwise */ bool stream_read_line(Stream* stream, string_t str_result);