summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/repodata.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/repodata.c b/src/repodata.c
index c35da23..d527a42 100644
--- a/src/repodata.c
+++ b/src/repodata.c
@@ -2102,6 +2102,7 @@ repodata_extend_block(Repodata *data, Id start, Id num)
return;
if (!data->incoreoffset)
{
+ /* this also means that data->attrs is NULL */
data->incoreoffset = solv_calloc_block(num, sizeof(Id), REPODATA_BLOCK);
data->start = start;
data->end = start + num;
@@ -2812,6 +2813,10 @@ repodata_swap_attrs(Repodata *data, Id dest, Id src)
Id *tmpattrs;
if (!data->attrs || dest == src)
return;
+ if (dest < data->start || dest >= data->end)
+ repodata_extend(data, dest);
+ if (src < data->start || src >= data->end)
+ repodata_extend(data, src);
tmpattrs = data->attrs[dest - data->start];
data->attrs[dest - data->start] = data->attrs[src - data->start];
data->attrs[src - data->start] = tmpattrs;