#3579 p18Value causes NPE in WikidataEditService createClaimWithLogging - add null check (#3580)

This commit is contained in:
Seán Mac Gillicuddy 2020-03-24 14:59:44 +00:00 committed by GitHub
parent 8cb4e28a97
commit 7ed911808d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,7 +50,7 @@ public class WikidataEditService {
* @param fileName name of the file we will upload * @param fileName name of the file we will upload
* @param p18Value pic attribute of Wikidata item * @param p18Value pic attribute of Wikidata item
*/ */
public void createClaimWithLogging(String wikidataEntityId, String wikiItemName, String fileName, @NonNull String p18Value) { public void createClaimWithLogging(String wikidataEntityId, String wikiItemName, String fileName, String p18Value) {
if (wikidataEntityId == null) { if (wikidataEntityId == null) {
Timber.d("Skipping creation of claim as Wikidata entity ID is null"); Timber.d("Skipping creation of claim as Wikidata entity ID is null");
return; return;
@ -66,7 +66,7 @@ public class WikidataEditService {
return; return;
} }
if (!p18Value.trim().isEmpty()) { if (p18Value != null && !p18Value.trim().isEmpty()) {
Timber.d("Skipping creation of claim as p18Value is not empty, we won't override existing image"); Timber.d("Skipping creation of claim as p18Value is not empty, we won't override existing image");
return; return;
} }