From cf70eea0a119e7048793689bc8bea3ad93bb2a17 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 12 Feb 2022 23:00:27 +0100 Subject: [PATCH] Fix meaning-tag IndexError bug --- lib/src/phrase_scrape.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/phrase_scrape.dart b/lib/src/phrase_scrape.dart index 40c30c3..c9f6bb0 100644 --- a/lib/src/phrase_scrape.dart +++ b/lib/src/phrase_scrape.dart @@ -159,11 +159,12 @@ PhrasePageScrapeResultData _getMeaningsOtherFormsAndNotes( var notes; for (var child in meaningsWrapper.children) { + final mostRecentWordType = mostRecentWordTypes.length >= 1 ? mostRecentWordTypes[0] : null; if (child.className.contains('meaning-tags')) { mostRecentWordTypes = _getMostRecentWordTypes(child); - } else if (mostRecentWordTypes[0] == 'other forms') { + } else if (mostRecentWordType == 'other forms') { otherForms = _getOtherForms(child); - } else if (mostRecentWordTypes[0] == 'notes') { + } else if (mostRecentWordType == 'notes') { notes = _getNotes(child); } else { meanings.add(_getMeaning(child));