Parcourir la source

addPackage needs to trigger initialization too

Jordi Boggiano il y a 14 ans
Parent
commit
05d527446b
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      src/Composer/Repository/ArrayRepository.php

+ 3 - 0
src/Composer/Repository/ArrayRepository.php

@@ -30,6 +30,9 @@ class ArrayRepository implements RepositoryInterface
      */
     public function addPackage(PackageInterface $package)
     {
+        if (null === $this->packages) {
+            $this->initialize();
+        }
         $package->setRepository($this);
         $this->packages[] = $package;
     }