Check service existence before use in Debug mode

This commit is contained in:
Paul Schneider 2018-12-18 17:47:21 +00:00
commit 0a9e4a3f9d
2 changed files with 20 additions and 1 deletions

View file

@ -302,6 +302,9 @@ namespace Yavsc.Controllers
public async Task<IActionResult> SetGoogleCalendar(string returnUrl, string pageToken)
{
#if Debug
if (_calendarManager==null) throw new Exception("No service!");
#endif
var calendar = await _calendarManager.GetCalendarsAsync(User.GetUserId(), pageToken);
if (calendar == null)
return new ChallengeResult();