From 5c70b9957b5813479439a515d499badf862fe469 Mon Sep 17 00:00:00 2001
From: Alex Barth <alex_b@53995.no-reply.drupal.org>
Date: Mon, 21 Dec 2009 00:32:55 +0000
Subject: [PATCH] #663830 Aron Novak, alex_b: When download of URL failed, node
 w/ empty title is created.

---
 feeds.module | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/feeds.module b/feeds.module
index 3ddcfecf..607a9fc2 100644
--- a/feeds.module
+++ b/feeds.module
@@ -250,18 +250,16 @@ function feeds_nodeapi(&$node, $op, $form) {
             // @todo Too many indirections. Clean up.
             $batch = $source->importer->fetcher->fetch($source);
             $source->importer->parser->parse($batch, $source);
-            if (!$batch->getTitle()) {
-              form_set_error('title', t('Could not retrieve title from feed.'), 'error');
-            }
-            else {
-              // Keep the title in a static cache and populate $node->title on
-              // 'presave' as node module looses any changes to $node after
-              // 'validate'.
-              $last_title = $batch->getTitle();
+            // Keep the title in a static cache and populate $node->title on
+            // 'presave' as node module looses any changes to $node after
+            // 'validate'.
+            if (!$last_title = $batch->getTitle()) {
+              throw new Exception();
             }
           }
           catch (Exception $e) {
             drupal_set_message($e->getMessage(), 'error');
+            form_set_error('title', t('Could not retrieve title from feed.'), 'error');
           }
         }
 
-- 
GitLab