aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ApartmentManager/ApartmentManager/Persistency/ImgurPhotoUploader.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/ApartmentManager/ApartmentManager/Persistency/ImgurPhotoUploader.cs b/ApartmentManager/ApartmentManager/Persistency/ImgurPhotoUploader.cs
index 7e9ebf2..ed0041e 100644
--- a/ApartmentManager/ApartmentManager/Persistency/ImgurPhotoUploader.cs
+++ b/ApartmentManager/ApartmentManager/Persistency/ImgurPhotoUploader.cs
@@ -39,10 +39,14 @@ namespace ApartmentManager.Persistency
StorageFile file = await fp.PickSingleFileAsync();
//Upload to Imgur and return link
- var client = new ImgurClient("7b05a61ed8df74f", "ade6f79163e19f92f852bc553bbe399d7d4218fe");
- var endpoint = new ImageEndpoint(client);
- IImage image = await endpoint.UploadImageStreamAsync(await file.OpenStreamForReadAsync());
- return image.Link;
+ if (file != null)
+ {
+ var client = new ImgurClient("7b05a61ed8df74f", "ade6f79163e19f92f852bc553bbe399d7d4218fe");
+ var endpoint = new ImageEndpoint(client);
+ IImage image = await endpoint.UploadImageStreamAsync(await file.OpenStreamForReadAsync());
+ return image.Link;
+ }
+ else return "";
}
}
} \ No newline at end of file