Преглед на файлове

Fix edgecase with nonexistent tweet not withheld

Zed преди 7 години
родител
ревизия
369dc994b8
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      src/parser.nim

+ 3 - 0
src/parser.nim

@@ -88,6 +88,9 @@ proc parseQuote*(quote: XmlNode): Quote =
   result.getQuoteMedia(quote)
 
 proc parseTweet*(node: XmlNode): Tweet =
+  if node == nil:
+    return Tweet()
+
   if "withheld" in node.attr("class"):
     return Tweet(tombstone: getTombstone(node.selectText(".Tombstone-label")))