]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Don't try to import a <dd> without a <dt> from delicious
authorEvan Prodromou <evan@status.net>
Thu, 31 Mar 2011 20:15:30 +0000 (16:15 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 31 Mar 2011 20:15:30 +0000 (16:15 -0400)
plugins/Bookmark/deliciousbackupimporter.php

index 197c7a143bc18af208782ca91c5e82af87858e7a..7439c8f85305bc5480233aaa2dc570c95987e2b6 100644 (file)
@@ -79,6 +79,12 @@ class DeliciousBackupImporter extends QueueHandler
 
         $doc = $this->importHTML($body);
 
+        // If we can't parse it, it's no good
+
+        if (empty($doc)) {
+            return true;
+        }
+
         $dls = $doc->getElementsByTagName('dl');
 
         if ($dls->length != 1) {
@@ -112,9 +118,11 @@ class DeliciousBackupImporter extends QueueHandler
                 case 'dd':
                     $dd = $child;
 
-                    // This <dd> contains a description for the bookmark in
-                    // the preceding <dt> node.
-                    $saved = $this->importBookmark($user, $dt, $dd);
+                    if (!empty($dt)) {
+                        // This <dd> contains a description for the bookmark in
+                        // the preceding <dt> node.
+                        $saved = $this->importBookmark($user, $dt, $dd);
+                    }
 
                     $dt = null;
                     $dd = null;