Fix hypothetical crash bug in AspectDefinition#addAllAttributesOfAspect when the default value of a parameterized aspect attribute is null. This is hypothetical because I couldn't figure out an end-to-end way to tickle the bug. Still, the surrounding code is very brittle and things may change in the future such that the bug is trivially tickle-able.

--
MOS_MIGRATED_REVID=124977450
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java b/src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java
index 606b177..20c2a6a 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java
@@ -29,6 +29,7 @@
 import java.util.Collection;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -178,6 +179,11 @@
     return classStrings.build();
   }
 
+  @Nullable
+  private static Label maybeGetRepositoryRelativeLabel(Rule from, @Nullable Label label) {
+    return label == null ? null : from.getLabel().resolveRepositoryRelative(label);
+  }
+
   /**
    * Collects all attribute labels from the specified aspectDefinition.
    */
@@ -192,14 +198,21 @@
         continue;
       }
       if (aspectAttribute.getType() == BuildType.LABEL) {
-        Label label = from.getLabel().resolveRepositoryRelative(
-            BuildType.LABEL.cast(aspectAttribute.getDefaultValue(from)));
+        Label label = maybeGetRepositoryRelativeLabel(
+            from, BuildType.LABEL.cast(aspectAttribute.getDefaultValue(from)));
         if (label != null) {
           labelBuilder.put(aspectAttribute, label);
         }
       } else if (aspectAttribute.getType() == BuildType.LABEL_LIST) {
-        for (Label label : BuildType.LABEL_LIST.cast(aspectAttribute.getDefaultValue(from))) {
-          labelBuilder.put(aspectAttribute, from.getLabel().resolveRepositoryRelative(label));
+        List<Label> defaultLabels = BuildType.LABEL_LIST.cast(
+            aspectAttribute.getDefaultValue(from));
+        if (defaultLabels != null) {
+          for (Label defaultLabel : defaultLabels) {
+            Label label = maybeGetRepositoryRelativeLabel(from, defaultLabel);
+            if (label != null) {
+              labelBuilder.put(aspectAttribute, label);
+            }
+          }
         }
       }
     }