Add error check for kanji search

This commit is contained in:
Oystein Kristoffer Tveit 2020-07-16 14:08:35 +02:00
parent 9633693c9b
commit e254d128a3
1 changed files with 2 additions and 1 deletions

View File

@ -23,7 +23,8 @@ class KanjiBloc extends Bloc<KanjiEvent, KanjiState> {
try {
final _kanji = await fetchKanji(event.kanjiSearchString);
yield KanjiSearchFinished(kanji: _kanji);
if (_kanji.found) yield KanjiSearchFinished(kanji: _kanji);
else yield KanjiSearchError('Something went wrong');
} on Exception {
yield KanjiSearchError('Something went wrong');
}