From adcae4353d121c64441d5762bc12045582b32bc1 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Fri, 4 Nov 2016 20:59:14 +0900 Subject: [PATCH] =?utf8?q?TabModel.AddPostQueue=E3=83=A1=E3=82=BD=E3=83=83?= =?utf8?q?=E3=83=89=E3=81=A7=E8=BF=BD=E5=8A=A0=E3=81=95=E3=82=8C=E3=82=8BI?= =?utf8?q?D=E3=81=8CPosts=E5=86=85=E3=81=AB=E5=AD=98=E5=9C=A8=E3=81=99?= =?utf8?q?=E3=82=8B=E3=81=8B=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=82=92?= =?utf8?q?=E8=A1=8C=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween/Models/InternalStorageTabModel.cs | 5 ++--- OpenTween/Models/TabModel.cs | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenTween/Models/InternalStorageTabModel.cs b/OpenTween/Models/InternalStorageTabModel.cs index 298bcc8e..3512dab8 100644 --- a/OpenTween/Models/InternalStorageTabModel.cs +++ b/OpenTween/Models/InternalStorageTabModel.cs @@ -50,10 +50,9 @@ namespace OpenTween.Models if (TabInformations.GetInstance().IsMuted(post, isHomeTimeline: false)) return; - base.AddPostQueue(post); + this.internalPosts.TryAdd(post.StatusId, post); - if (!this.internalPosts.TryAdd(post.StatusId, post)) - return; + base.AddPostQueue(post); } public override void EnqueueRemovePost(long statusId, bool setIsDeleted) diff --git a/OpenTween/Models/TabModel.cs b/OpenTween/Models/TabModel.cs index c6481dd7..3cca9c06 100644 --- a/OpenTween/Models/TabModel.cs +++ b/OpenTween/Models/TabModel.cs @@ -96,6 +96,9 @@ namespace OpenTween.Models public virtual void AddPostQueue(PostClass post) { + if (!this.Posts.ContainsKey(post.StatusId)) + throw new ArgumentException("Specified post not exists in storage", nameof(post)); + this.addQueue.Enqueue(new TemporaryId(post.StatusId, post.IsRead)); } -- 2.11.0