Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r21121: LJSUP-11180 (do not return undefined val...

Committer: ailyin
LJSUP-11180 (do not return undefined values from load_renamed_user)
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2012-02-07 15:04:13 UTC (rev 21120)
+++ trunk/cgi-bin/LJ/User.pm	2012-02-08 07:17:48 UTC (rev 21121)
@@ -6055,9 +6055,19 @@
             my $rt = $u->prop("renamedto");
             last unless length $rt;
             if ($rt =~ /^https?:\/\//){
-                $u = LJ::User->new_from_url($rt);
+                if ( my $newu = LJ::User->new_from_url($rt) ) {
+                    $u = $newu;
+                } else {
+                    warn $u->username . " links to non-existent user at $rt";
+                    return $u;
+                }
             } else {
-                $u = LJ::load_user($rt);
+                if ( my $newu = LJ::load_user($rt) ) {
+                    $u = $newu;
+                } else {
+                    warn $u->username . " links to non-existent user at $rt";
+                    return $u;
+                }
             }
         }
     }

Tags: ailyin, andy, livejournal, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments