diff --git a/recomp/patches.py b/recomp/patches.py index 170e540f..58bf3c1f 100644 --- a/recomp/patches.py +++ b/recomp/patches.py @@ -196,6 +196,8 @@ def load(path, mods): image, end = json.JSONDecoder().raw_decode(prefix[4]) except json.JSONDecodeError as e: raise PatchError(f'{where}: invalid quoted plugin image: {e.msg}') from None + if not image: + raise PatchError(f'{where}: empty quoted plugin image') tail = prefix[4][end:].strip() if tail and not tail.startswith('#'): raise PatchError(f'{where}: unexpected text after quoted plugin image') diff --git a/tests/exefs_plugins_test.py b/tests/exefs_plugins_test.py index 2f6d4bd0..b35f4549 100644 --- a/tests/exefs_plugins_test.py +++ b/tests/exefs_plugins_test.py @@ -390,7 +390,7 @@ class Lines(unittest.TestCase): mods = [('main', MAIN, 0x200000), ('plugin0', PLUGIN, 0x14000)] with tempfile.TemporaryDirectory() as d: patch = Path(d) / 'patches.txt' - for field in ('"unfinished', '"image.img" extra', '"image.img" "#not a comment"'): + for field in ('"unfinished', '""', '"image.img" extra', '"image.img" "#not a comment"'): with self.subTest(field=field): patch.write_text(f'set x ENV 0\nplugin x plugin0 {"0" * 64} {field}\n') with self.assertRaises(patches.PatchError) as error: