diff --git a/lib/plist.c b/lib/plist.c index b1a5cd79..b447bda2 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -111,10 +111,12 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp, if (xbps_object_type(array) != XBPS_TYPE_ARRAY) return 0; - arraycount = xbps_array_count(array); - if (arraycount == 0) + if (!xbps_array_count(array)) return 0; + /* - 1 because there's a private dict used internally */ + arraycount = xbps_array_count(array) - 1; + maxthreads = (int)sysconf(_SC_NPROCESSORS_ONLN); if (maxthreads <= 1 || arraycount <= 1) /* use single threaded routine */ return xbps_array_foreach_cb(xhp, array, dict, fn, arg);