Shlomi Fish avatar Shlomi Fish committed 111c423

$pagination_div can be undef.

Comments (0)

Files changed (2)

modules/WWW-Search-MSN/Changes

 Revision history for WWW-Search-MSN
 
+0.0106
+        - Making sure we do the right thing, when a possibly non-existent 
+        element was not found and as a result was assigned undef.
+            - Fixes https://rt.cpan.org/Ticket/Display.html?id=43339
+
 0.0105  Thu Nov 27 21:29:46 IST 2008
         - Updated to the new MSN Search syntax.
 

modules/WWW-Search-MSN/lib/WWW/Search/MSN.pm

 
     # Get the next URL
     {
-        my $pagination_div = $tree->look_down("_tag", "div", "class", "sb_pag");
-        my ($a_tag) = $pagination_div->look_down("_tag", "a", "class", "sb_pagN");
+        my $pagination_div =
+            $tree->look_down("_tag", "div", "class", "sb_pag");
+        if ($pagination_div)
+        {
+            my ($a_tag) = $pagination_div->look_down(
+                "_tag", "a", "class", "sb_pagN"
+            );
 
-        if ($a_tag)
-        {
-            $self->{'_next_url'} =
-                $self->absurl(
-                        $self->{'_prev_url'},
-                        $a_tag->attr('href')
-                    );
+            if ($a_tag)
+            {
+                $self->{'_next_url'} =
+                    $self->absurl(
+                            $self->{'_prev_url'},
+                            $a_tag->attr('href')
+                        );
+            }
         }
     }
     return $hits_found;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.