--- /usr/lib/portage/pym/portage.py.orig	2004-02-20 10:11:08.000000000 +0100
+++ /usr/lib/portage/pym/portage.py	2004-02-20 09:45:10.000000000 +0100
@@ -3035,7 +3035,7 @@
 								match=0
 						if match:
 							return x
-					elif myportapi.match(x):
+					elif myportapi and myportapi.match(x):
 						return x
 
 			#none of the not masked pkg, use the first one