Skip to content

Commit

Permalink
USAT: add check for malformed xml data (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisparker authored Oct 27, 2023
1 parent 885a502 commit 8b77bce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion xword_dl/downloader/amuniversaldownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import time
import urllib
import xml

import puz
import requests
Expand Down Expand Up @@ -160,7 +161,10 @@ def fetch_data(self, solver_url):
return xw_data

def parse_xword(self, xword_data):
xw = xmltodict.parse(xword_data).get('crossword')
try:
xw = xmltodict.parse(xword_data).get('crossword')
except xml.parsers.expat.ExpatError:
raise XWordDLException('Puzzle data malformed, cannot parse.')

puzzle = puz.Puzzle()

Expand Down

0 comments on commit 8b77bce

Please sign in to comment.