From be641700f8f0e549861f0223b42674e7c83e0bc7 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 25 Mar 2017 16:56:05 -0400 Subject: Bagels. --- Project-Unite/Controllers/ManageController.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Project-Unite/Controllers/ManageController.cs') diff --git a/Project-Unite/Controllers/ManageController.cs b/Project-Unite/Controllers/ManageController.cs index 5f68eea..99f41c9 100644 --- a/Project-Unite/Controllers/ManageController.cs +++ b/Project-Unite/Controllers/ManageController.cs @@ -43,12 +43,15 @@ namespace Project_Unite.Controllers string[] allowedTypes = new[] { ".png", ".jpg", ".bmp", ".jpeg", ".gif" }; bool containsAllowedType = false; - foreach(var ending in allowedTypes) + if (model.Image != null) { - if (model.Image.FileName.EndsWith(ending)) + foreach (var ending in allowedTypes) { - containsAllowedType = true; - break; + if (model.Image.FileName.EndsWith(ending)) + { + containsAllowedType = true; + break; + } } } if (containsAllowedType == false) -- cgit v1.2.3