]> sigrok.org Git - sigrok-androidutils.git/commitdiff
CopyLibsTask: Fix null dereference in getLibForSoname
authorMarcus Comstedt <redacted>
Tue, 3 Nov 2015 19:25:01 +0000 (20:25 +0100)
committerUwe Hermann <redacted>
Fri, 25 Nov 2016 13:08:38 +0000 (14:08 +0100)
If either there are no <include> or no <exclude> directives,
then getIncludePatterns() or getExcludePatterns() will return
null, so handle that.

ant/src/org/sigrok/androidutils/ant/CopyLibsTask.java

index 58cfe25d482b911a066c42dbc15911a98909e944..969faf39cd4e1f9c266fc220af8260bf0aa4d3f9 100644 (file)
@@ -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);