From 40be2adfd71d49f9d9e3654278b20a4648a0c70d Mon Sep 17 00:00:00 2001
From: Krystian Kabat <krykab@st.amu.edu.pl>
Date: Sun, 27 Jan 2019 13:59:15 +0100
Subject: [PATCH] =?UTF-8?q?Dodano=20obs=C5=82ug=C4=99=20wyj=C4=85tku,=20kt?=
 =?UTF-8?q?=C3=B3ry=20wy=C5=9Bwietla=20b=C5=82=C4=85d,=20gdy=20w=20polu=20?=
 =?UTF-8?q?dodania/odj=C4=99cia=20ilo=C5=9Bci=20owoc=C3=B3w=20wpiszemy=20t?=
 =?UTF-8?q?ekst=20zamiast=20liczby=20dodatniej.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Magazyn/Windows/AmountWindow.xaml.cs          | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml.cs b/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml.cs
index 4b25ad1..83b4687 100644
--- a/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml.cs
+++ b/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml.cs
@@ -73,7 +73,20 @@ namespace Magazyn.Windows
 
         private void SendNewQuantity()
         {
-            int amount = int.Parse(amountToChange.Text);
+            int amount;
+            try
+            {
+                amount = int.Parse(amountToChange.Text);
+            }
+            catch
+            {
+                ErrorWindow window = new ErrorWindow("Podana wartość jest nieprawidłowa, proszę podać liczbę dodatnią.");
+                window.Owner = Application.Current.MainWindow;
+                window.ShowDialog();
+                amountToChange.Text = "0";
+                return;
+            }
+
             try
             {
                 if (amount < 0)