Merge branch 'fix-739--empty-description' into 'master'

Ensure that description is not null when parsing index.

At time of writing (and for some time before), fdroidserver has forced
a description of "No description available" for apps which don't have
descriptions at all:

 * https://gitlab.com/fdroid/fdroidserver/blob/0.6.0/fdroidserver/metadata.py#L876

However, if the description is not set for whatever reason, it should not
crash the client.

Identified in the now closed #739.

See merge request !380
This commit is contained in:
Daniel Martí 2016-08-17 16:29:21 +00:00
commit 252330fb86

View File

@ -265,6 +265,11 @@ public class RepoXMLHandler extends DefaultHandler {
} else if ("application".equals(localName) && curapp == null) { } else if ("application".equals(localName) && curapp == null) {
curapp = new App(); curapp = new App();
curapp.packageName = attributes.getValue("", "id"); curapp.packageName = attributes.getValue("", "id");
// To appease the NON NULL constraint in the DB. Usually there is a description, and it
// is quite difficult to get an app to _not_ have a description when using fdroidserver.
// However, it shouldn't crash the client when this happens.
curapp.description = "";
} else if ("package".equals(localName) && curapp != null && curapk == null) { } else if ("package".equals(localName) && curapp != null && curapk == null) {
curapk = new Apk(); curapk = new Apk();
curapk.packageName = curapp.packageName; curapk.packageName = curapp.packageName;