Revision
69339
Author
snc@macports.org
Date
2010-07-01 05:15:59 -0700 (Thu, 01 Jul 2010)

Log Message

check that patchfiles is set before using it

Modified Paths

Diff

Modified: trunk/base/src/port1.0/portclean.tcl (69338 => 69339)


--- trunk/base/src/port1.0/portclean.tcl	2010-07-01 04:53:57 UTC (rev 69338)
+++ trunk/base/src/port1.0/portclean.tcl	2010-07-01 12:15:59 UTC (rev 69339)
@@ -124,25 +124,27 @@
     }
 
     set count 0
-    foreach file [option patchfiles] {
-        set patchfile [getdistname $file]
-        ui_debug "Looking for $patchfile"
-        set patchfile [file join $distpath $patchfile]
-        if {[file isfile $patchfile]} {
-            ui_debug "Removing file: $patchfile"
-            if {[catch {delete $patchfile} result]} {
-                ui_debug "$::errorInfo"
-                ui_error "$result"
+    if {info exists patchfiles} {
+        foreach file [option patchfiles] {
+            set patchfile [getdistname $file]
+            ui_debug "Looking for $patchfile"
+            set patchfile [file join $distpath $patchfile]
+            if {[file isfile $patchfile]} {
+                ui_debug "Removing file: $patchfile"
+                if {[catch {delete $patchfile} result]} {
+                    ui_debug "$::errorInfo"
+                    ui_error "$result"
+                }
+                incr count
             }
-            incr count
-        }
-        if {!$usealtworkpath && [file isfile ${altprefix}${patchfile}]} {
-            ui_debug "Removing file: ${altprefix}${patchfile}"
-            if {[catch {delete ${altprefix}${patchfile}} result]} {
-                ui_debug "$::errorInfo"
-                ui_error "$result"
+            if {!$usealtworkpath && [file isfile ${altprefix}${patchfile}]} {
+                ui_debug "Removing file: ${altprefix}${patchfile}"
+                if {[catch {delete ${altprefix}${patchfile}} result]} {
+                    ui_debug "$::errorInfo"
+                    ui_error "$result"
+                }
+                incr count
             }
-            incr count
         }
     }
     if {$count > 0} {