From cb419cd85c59b36a145a84cd7b3dc6b314ed16ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= <lbphacker@gmail.com>
Date: Sun, 2 Feb 2020 12:16:04 +0100
Subject: [PATCH] Failure to remove a tag shouldn't be fatal

---
 src/gui/tags/TagsView.cpp | 15 ++++++++++-----
 src/gui/tags/TagsView.h   |  1 -
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/gui/tags/TagsView.cpp b/src/gui/tags/TagsView.cpp
index d613b4e91..ca57cbf31 100644
--- a/src/gui/tags/TagsView.cpp
+++ b/src/gui/tags/TagsView.cpp
@@ -83,7 +83,16 @@ void TagsView::NotifyTagsChanged(TagsModel * sender)
 				tempButton->Appearance.Margin.Top += 2;
 				tempButton->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
 				tempButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
-				tempButton->SetActionCallback({ [this, tag] { c->RemoveTag(tag); } });
+				tempButton->SetActionCallback({ [this, tag] {
+					try
+					{
+						c->RemoveTag(tag);
+					}
+					catch(TagsModelException & ex)
+					{
+						new ErrorMessage("Could not remove tag", ByteString(ex.what()).FromUtf8());
+					}
+				} });
 				tags.push_back(tempButton);
 				AddComponent(tempButton);
 			}
@@ -125,7 +134,3 @@ void TagsView::addTag()
 	}
 	tagInput->SetText("");
 }
-
-TagsView::~TagsView() {
-}
-
diff --git a/src/gui/tags/TagsView.h b/src/gui/tags/TagsView.h
index da2366ab4..318491160 100644
--- a/src/gui/tags/TagsView.h
+++ b/src/gui/tags/TagsView.h
@@ -27,7 +27,6 @@ public:
 	void AttachController(TagsController * c_) { c = c_; }
 	void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
 	void NotifyTagsChanged(TagsModel * sender);
-	virtual ~TagsView();
 };
 
 #endif /* TAGSVIEW_H_ */