websetup: Avoid a crash when a new array setup item has been added in a new ikiwiki...
authorJoey Hess <joey@gnu.kitenet.net>
Wed, 31 Dec 2008 05:44:54 +0000 (00:44 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Wed, 31 Dec 2008 05:44:54 +0000 (00:44 -0500)
This happened with camelcase_ignore. The code tried to convert the undef
value for it into an array.

IkiWiki/Plugin/websetup.pm
debian/changelog

index 2d978c5b46758e3ad2234f4d0bc8ba73d80e89b1..95d044c08a5d46ada18308d6448efebede1732af 100644 (file)
@@ -138,9 +138,8 @@ sub showfields ($$$@) {
 
                my $value=$config{$key};
 
-               if ($info{safe} && defined $value &&
-                   (ref $value eq 'ARRAY' || ref $info{example} eq 'ARRAY')) {
-                       $value=[@{$value}, "", ""]; # blank items for expansion
+               if ($info{safe} && (ref $value eq 'ARRAY' || ref $info{example} eq 'ARRAY')) {
+                       $value=[(ref $value eq 'ARRAY' ? @{$value} : ""), "", ""]; # blank items for expansion
                }
 
                if ($info{type} eq "string") {
index 13ceb875f74f4671e3e08e32d1f6ad30ed8836df..51c9617f7325e10ba3e63d1b0563acde711f75b4 100644 (file)
@@ -20,6 +20,8 @@ ikiwiki (3.00) UNRELEASED; urgency=low
   * htmlbalance: Demand-load HTML::TreeBuilder to avoid failing test suite
     if it is not present.
   * French translation update from Philippe Batailler. Closes: #510216
+  * websetup: Avoid a crash when a new array setup item has been added in 
+    a new ikiwiki release, and is thus not present in the setup file yet.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 24 Dec 2008 19:49:36 -0500