summaryrefslogtreecommitdiff
path: root/fml/lib/Mail/Message.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-04-27 05:21:41 +0000
committerfukachan <fukachan>2002-04-27 05:21:41 +0000
commit337d49dfe7c07cf977451dd72a0ce1a4cb5432af (patch)
tree59910b9728b4cc3ea6ba9612c0bb7c60c127872a /fml/lib/Mail/Message.pm
parent6f5d876619cc24f962b65242b963c475663eade1 (diff)
downloadfml8-337d49dfe7c07cf977451dd72a0ce1a4cb5432af.tar.gz
fml8-337d49dfe7c07cf977451dd72a0ce1a4cb5432af.tar.bz2
fml8-337d49dfe7c07cf977451dd72a0ce1a4cb5432af.zip
check more data by defined()
Diffstat (limited to 'fml/lib/Mail/Message.pm')
-rw-r--r--fml/lib/Mail/Message.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/fml/lib/Mail/Message.pm b/fml/lib/Mail/Message.pm
index 299a495a..250ed903 100644
--- a/fml/lib/Mail/Message.pm
+++ b/fml/lib/Mail/Message.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Message.pm,v 1.53 2002/04/25 04:58:08 fukachan Exp $
+# $FML: Message.pm,v 1.54 2002/04/26 00:26:23 fukachan Exp $
#
package Mail::Message;
@@ -1679,7 +1679,8 @@ sub encoding_mechanism
my ($self) = @_;
my $buf = $self->message_fields();
- if ($buf =~ /Content-Transfer-Encoding:\s*(\S+)/mi) {
+ if (defined($buf) &&
+ ($buf =~ /Content-Transfer-Encoding:\s*(\S+)/mi)) {
my $mechanism = $1;
$mechanism =~ tr/A-Z/a-z/;
return $mechanism;
@@ -1827,9 +1828,14 @@ sub nth_paragraph
my $data = $self->{ data };
my $pmap = $self->_evaluate_pmap();
- $i--; # shift $i: 1 => 0, 2 =>1, et. al.
- my ($pb, $pe) = ($pmap->[ $i ], $pmap->[ $i + 1 ]);
- return substr($$data, $pb, $pe - $pb);
+ if (defined($$data) && $$data) {
+ $i--; # shift $i: 1 => 0, 2 =>1, et. al.
+ my ($pb, $pe) = ($pmap->[ $i ], $pmap->[ $i + 1 ]);
+ return substr($$data, $pb, $pe - $pb);
+ }
+ else {
+ return undef;
+ }
}
@@ -1846,6 +1852,10 @@ sub _evaluate_pmap
my $bodylen = $self->size;
my $data = $self->{ data };
+ unless (defined $data) {
+ return [];
+ }
+
my $i = 0; # the number of paragraphs
my $p = $pb;
my $pp = $p;