--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/jsonCheckSyntax.py Sat Jul 08 12:08:27 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/jsonCheckSyntax.py Sat Jul 08 16:20:59 2023 +0200 @@ -146,7 +146,7 @@ def __jsonSyntaxCheck(file, codestring): """ - Function to check a YAML source file for syntax errors. + Function to check a JSON source file for syntax errors. @param file source filename @type str @@ -158,16 +158,17 @@ errors), the message, a list with arguments for the message) @rtype dict """ - try: - json.loads(codestring) - except json.JSONDecodeError as exc: - line = exc.lineno - column = exc.colno - error = exc.msg + if codestring: + try: + json.loads(codestring) + except json.JSONDecodeError as exc: + line = exc.lineno + column = exc.colno + error = exc.msg - cline = min(len(codestring.splitlines()), int(line)) - 1 - code = codestring.splitlines()[cline] + cline = min(len(codestring.splitlines()), int(line)) - 1 + code = codestring.splitlines()[cline] - return [{"error": (file, line, column, code, error)}] + return [{"error": (file, line, column, code, error)}] return [{}]