From: David ‘Bombe’ Roden Date: Mon, 16 Mar 2009 23:10:44 +0000 (+0100) Subject: Don’t try to parse when no parser was found. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bc2a6cc23e93037cae7f52815f20bdf24504ce5d;p=arachne.git Don’t try to parse when no parser was found. --- diff --git a/src/net/pterodactylus/arachne/core/URLFetcher.java b/src/net/pterodactylus/arachne/core/URLFetcher.java index de09f71..ea109d0 100644 --- a/src/net/pterodactylus/arachne/core/URLFetcher.java +++ b/src/net/pterodactylus/arachne/core/URLFetcher.java @@ -121,6 +121,10 @@ class URLFetcher implements Runnable, ParserListener { urlInputStream = urlConnection.getInputStream(); hashInputStream = new MessageDigestInputStream(urlInputStream, messageDigest); Parser parser = parserFactory.getParser(contentType); + if (parser == null) { + logger.log(Level.INFO, "No parser found for “" + contentType + "”."); + return; + } parser.parse(this, hashInputStream, "UTF-8"); hash = messageDigest.digest(); } catch (IOException ioe1) {