Commits

Tanner Mares committed 10af197

Fixed infinite loop created when only one post exists

  • Participants
  • Parent commits b78cd17

Comments (0)

Files changed (1)

     def get
       if $store.dropbox_session
         @last = $store.last
-        @random = $store.random
-        while @random.id == @last.id
-          @random =  $store.random
+        if $store.posts.size > 1
+          @random = $store.random
+          while @random.id == @last.id
+            @random =  $store.random
+          end
         end
         render :index
       else
       div.tags! {render_tags(@last.tags_to_arr) }
     end
     hr
-    render_post @random, "Random"
+    render_post @random, "Random" if @random
   end
 
   def single