Check service existence before use in Debug mode

This commit is contained in:
2018-12-18 17:47:21 +00:00
parent defdbf86dd
commit 225e364e9f
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();