- make iterator work withj completely empty repos
authorMichael Schroeder <mls@suse.de>
Wed, 15 Oct 2008 22:50:33 +0000 (22:50 +0000)
committerMichael Schroeder <mls@suse.de>
Wed, 15 Oct 2008 22:50:33 +0000 (22:50 +0000)
src/repodata.c

index 8cd13b1..ae4d470 100644 (file)
@@ -1047,7 +1047,11 @@ dataiterator_step(Dataiterator *di)
 
        case di_enterrepodata: di_enterrepodata:
          if (di->repodataid >= 0)
-           di->data = di->repo->repodata + di->repodataid;
+           {
+             if (di->repodataid >= di->repo->nrepodata)
+               goto di_nextsolvable;
+             di->data = di->repo->repodata + di->repodataid;
+           }
          if (!maybe_load_repodata(di->data, di->keyname))
            goto di_nextrepodata;
          di->dp = solvid2data(di->data, di->solvid, &schema);
@@ -1102,7 +1106,7 @@ dataiterator_step(Dataiterator *di)
              goto di_enterrepodata;
          /* FALLTHROUGH */
 
-       case di_nextsolvable:
+       case di_nextsolvable: di_nextsolvable:
          if (!(di->flags & SEARCH_THISSOLVID))
            {
              if (di->solvid < 0)