diff --git a/language_formatters_pre_commit_hooks/pretty_format_java.py b/language_formatters_pre_commit_hooks/pretty_format_java.py index 6e90cb1..47da71d 100644 --- a/language_formatters_pre_commit_hooks/pretty_format_java.py +++ b/language_formatters_pre_commit_hooks/pretty_format_java.py @@ -34,7 +34,7 @@ def get_urls(_version: str) -> typing.List[str]: try: return download_url(url_to_download, "google-java-formatter{version}.jar".format(version=version)) except requests.HTTPError as e: - if e.response.status_code != 404: + if not e.response or e.response.status_code != 404: # If the url was not found then move forward with the next links raise