From 54cfba56dc6c77d85edb467d99dd219e0b0deda9 Mon Sep 17 00:00:00 2001
From: Sam Saffron <sam.saffron@gmail.com>
Date: Tue, 17 May 2016 09:35:30 +1000
Subject: [PATCH] FIX: handle missing user for posts

---
 app/views/list/list.rss.erb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/views/list/list.rss.erb b/app/views/list/list.rss.erb
index 7cc954ec2a0..78193a8f0d7 100644
--- a/app/views/list/list.rss.erb
+++ b/app/views/list/list.rss.erb
@@ -12,12 +12,16 @@
       <atom:link href="<%= @atom_link %>" rel="self" type="application/rss+xml" />
       <% @topic_list.topics.each do |topic| %>
         <% topic_url = topic.url -%>
+        <% username = topic.user ? topic.user.username : "" %>
+        <% name = topic.user ? topic.user.name : "" %>
         <item>
           <title><%= topic.title %></title>
-          <dc:creator><![CDATA[<%= "@#{topic.user.username}#{" #{topic.user.name}" if (topic.user.name.present? && SiteSetting.enable_names?)}" -%>]]></dc:creator>
+          <dc:creator><![CDATA[<%= "@#{username}#{" #{name}" if (name.present? && SiteSetting.enable_names?)}" -%>]]></dc:creator>
           <category><%= topic.category.name %></category>
           <description><![CDATA[
-          <p><%= t('author_wrote', author: link_to("@#{topic.user.username}", "#{Discourse.base_url}/users/#{topic.user.username_lower}")).html_safe %></p>
+            <% if username.present? %>
+            <p><%= t('author_wrote', author: link_to("@#{username}", "#{Discourse.base_url}/users/#{topic.user.username_lower}")).html_safe %></p>
+            <% end %>
             <blockquote>
               <%= topic.posts.first.cooked.html_safe %>
             </blockquote>