From 9ae3f3c50a66a6134e5b1a47ed51c7a2347735cf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 16 Oct 2013 13:35:49 +0400 Subject: [PATCH] headlinesrequest: do not try to remove excess items if requested with offset=0 --- src/org/fox/ttrss/util/HeadlinesRequest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/org/fox/ttrss/util/HeadlinesRequest.java b/src/org/fox/ttrss/util/HeadlinesRequest.java index 8f0814c5..fb8aed1b 100644 --- a/src/org/fox/ttrss/util/HeadlinesRequest.java +++ b/src/org/fox/ttrss/util/HeadlinesRequest.java @@ -40,14 +40,18 @@ public class HeadlinesRequest extends ApiRequest { Type listType = new TypeToken>() {}.getType(); final List
articles = new Gson().fromJson(content, listType); - while (m_articles.size() > HEADLINES_BUFFER_MAX) - m_articles.remove(0); - - if (m_offset == 0) + if (m_offset == 0) { m_articles.clear(); - else - if (m_articles.get(m_articles.size()-1).id == -1) + } else { + while (m_articles.size() > HEADLINES_BUFFER_MAX) { + m_articles.remove(0); + } + + if (m_articles.get(m_articles.size()-1).id == -1) { m_articles.remove(m_articles.size()-1); // remove previous placeholder + } + + } for (Article f : articles) if (!m_articles.containsId(f.id))