From: Marcus Comstedt Date: Tue, 3 Nov 2015 19:25:01 +0000 (+0100) Subject: CopyLibsTask: Fix null dereference in getLibForSoname X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4785171b657e9a9c938fc631ad51921148d8e574;p=sigrok-androidutils.git CopyLibsTask: Fix null dereference in getLibForSoname If either there are no or no directives, then getIncludePatterns() or getExcludePatterns() will return null, so handle that. --- diff --git a/ant/src/org/sigrok/androidutils/ant/CopyLibsTask.java b/ant/src/org/sigrok/androidutils/ant/CopyLibsTask.java index 58cfe25..969faf3 100644 --- a/ant/src/org/sigrok/androidutils/ant/CopyLibsTask.java +++ b/ant/src/org/sigrok/androidutils/ant/CopyLibsTask.java @@ -328,16 +328,22 @@ public class CopyLibsTask extends Task if (l != null) return l; boolean include = false; - for (String patt : patterns.getIncludePatterns(getProject())) { - if (SelectorUtils.match(patt, s)) { - include = true; - break; + String[] includePatterns = patterns.getIncludePatterns(getProject()); + if (includePatterns != null) { + for (String patt : includePatterns) { + if (SelectorUtils.match(patt, s)) { + include = true; + break; + } } } if (!include) { - for (String patt : patterns.getExcludePatterns(getProject())) { - if (SelectorUtils.match(patt, s)) - return null; + String[] excludePatterns = patterns.getExcludePatterns(getProject()); + if (excludePatterns != null) { + for (String patt : excludePatterns) { + if (SelectorUtils.match(patt, s)) + return null; + } } } l = findLibInRpath(s, subdir);