Initialize just to avoid warnings; avoid unnecessary check when there's 
no theme to init anyway.

        Patch by fu. 

diffs (36 lines):

diff -r e3dcc8f71fbf -r dffe08acd2e0 cgi-bin/LJ/S2Theme.pm
--- a/cgi-bin/LJ/S2Theme.pm     Wed Nov 03 15:10:39 2010 +0800
+++ b/cgi-bin/LJ/S2Theme.pm     Wed Nov 03 18:33:10 2010 +0800
@@ -459,9 +459,11 @@ sub new {
 
     # package name for the theme
     my $theme_class = $self->{uniq};
-    $theme_class =~ s/-/_/g;
-    $theme_class =~ s/\//::/;
-    $theme_class = "LJ::S2Theme::$theme_class";
+    if ( $theme_class ) {
+        $theme_class =~ s/-/_/g;
+        $theme_class =~ s/\//::/;
+        $theme_class = "LJ::S2Theme::$theme_class";
+    }
 
     # package name for the layout
     my $layout_class = $self->{uniq} || $self->{layout_uniq};
@@ -470,7 +472,7 @@ sub new {
     $layout_class = "LJ::S2Theme::$layout_class";
 
     # make this theme an object of the lowest level class that's defined
-    if (eval { $theme_class->init }) {
+    if ( $theme_class && eval { $theme_class->init } ) {
         bless $self, $theme_class;
     } elsif (eval { $layout_class->init }) {
         bless $self, $layout_class;
@@ -511,7 +513,7 @@ sub layout_name {
 }
 
 sub uniq {
-    return $_[0]->{uniq};
+    return $_[0]->{uniq} || "";
 }
 
 sub layout_uniq {
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to