Commit 0028fb7a authored by Thibault Ehrhart's avatar Thibault Ehrhart

NewsCollector: fix crash when dateline is empty

parent 2abbb6c6
......@@ -76,8 +76,11 @@ final class AgenceFrancePresseMethods {
break;
case "DateLine":
final String dateline = streamReader.getElementText();
final String datelineLocation = dateline.substring(0, dateline.indexOf(","));
news.setDateline(datelineLocation);
final int pos = dateline.indexOf(",");
if (pos > -1) {
final String datelineLocation = dateline.substring(0, pos);
news.setDateline(datelineLocation);
}
break;
case "HeadLine":
news.addHeadline(streamReader.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang"), streamReader.getElementText());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment