Imported Upstream version 0.6.35
[platform/upstream/libsolv.git] / src / selection.c
index 6ca72e5..d44c482 100644 (file)
@@ -32,7 +32,7 @@ str2archid(Pool *pool, const char *arch)
   id = pool_str2id(pool, arch, 0);
   if (!id || id == ARCH_SRC || id == ARCH_NOSRC || id == ARCH_NOARCH)
     return id;
-  if (pool->id2arch && (id > pool->lastarch || !pool->id2arch[id]))
+  if (pool->id2arch && pool_arch2score(pool, id) == 0)
     return 0;
   return id;
 }
@@ -1383,6 +1383,8 @@ setup_limiter(Pool *pool, int flags, struct limiter *limiter)
 static int
 matchdep_str(const char *pattern, const char *string, int flags)
 {
+  if (!pattern || !string)
+    return 0;
   if (flags & SELECTION_GLOB)
     {
       int globflags = (flags & SELECTION_NOCASE) != 0 ? FNM_CASEFOLD : 0;
@@ -1444,6 +1446,8 @@ selection_make_matchdeps_common_limited(Pool *pool, Queue *selection, const char
     return 0;
   if (!name && !dep)
     return 0;
+  if (name && dep)
+    return 0;
 
   if ((flags & SELECTION_MATCH_DEPSTR) != 0)
     flags &= ~SELECTION_REL;