[Slashdotjp-dev 1537] [1068] Add check for journal_obj->get() argument

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 3月 11日 (水) 19:51:59 JST


Revision: 1068
          http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1068
Author:   tach
Date:     2009-03-11 19:51:59 +0900 (Wed, 11 Mar 2009)

Log Message:
-----------
Add check for journal_obj->get() argument

Modified Paths:
--------------
    slashjp/trunk/debian/changelog
    slashjp/trunk/plugins/Journal/Journal.pm


-------------- next part --------------
Modified: slashjp/trunk/debian/changelog
===================================================================
--- slashjp/trunk/debian/changelog	2009-03-11 10:14:05 UTC (rev 1067)
+++ slashjp/trunk/debian/changelog	2009-03-11 10:51:59 UTC (rev 1068)
@@ -4,6 +4,7 @@
   * Remove warning "Use of uninitialized value in int at
     /usr/lib/perl5/Slash/DB/MySQL.pm line 12950."
   * add shorten() method to Slash/Utility/Data/Data.pm
+  * Add check for journal_obj->get() argument
 
  -- Taku YASUI <tach****@osdn*****>  Wed, 11 Mar 2009 10:13:28 +0000
 

Modified: slashjp/trunk/plugins/Journal/Journal.pm
===================================================================
--- slashjp/trunk/plugins/Journal/Journal.pm	2009-03-11 10:14:05 UTC (rev 1067)
+++ slashjp/trunk/plugins/Journal/Journal.pm	2009-03-11 10:51:59 UTC (rev 1068)
@@ -19,7 +19,7 @@
 	my $uid = getCurrentUser('uid');
 	my $constants = getCurrentStatic();
 
-	return unless $self->sqlSelect('id', 'journals', "uid=$uid AND id=$id");
+	return unless ($id && $self->sqlSelect('id', 'journals', "uid=$uid AND id=$id"));
 
 	my(%j1, %j2);
 	%j1 = %$values;
@@ -225,6 +225,7 @@
 	my($self, $id) = @_;
 	my $uid = getCurrentUser('uid');
 
+	return unless $id;
 	my $journal = $self->get($id);
 	return unless $journal->{uid} == $uid;
 
@@ -809,8 +810,8 @@
 	if (ref($discussion) eq "HASH") {
 		$discussion = $discussion->{dkid};
 	}
-
-	return $self->get($self->sqlSelect('id', 'journals', "discussion=$discussion"));
+	my $id = $self->sqlSelect('id', 'journals', "discussion=$discussion");
+	return $id ? $self->get($id) : undef;
 }
 
 sub createJournalUrl {



Slashdotjp-dev メーリングリストの案内
Back to archive index