Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Commit

Permalink
Update Program.cs (#1567)
Browse files Browse the repository at this point in the history
NullRef on pagedCollection
  • Loading branch information
enriconatella authored and VesaJuvonen committed Nov 29, 2016
1 parent 46e3aff commit f1b2c80
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -84,7 +84,7 @@ private static async Task<List<GraphApi.IUser>> GetUsersFromActiveDirectory(Uri
pagedCollection = await pagedCollection.GetNextPageAsync();
//Below condition checks for the last batch of users and adds it to the list.
//Otherwise, the pagedCollection.MorePagesAvailable fails in the while condition and the loop misses the last batch of users.
if (!pagedCollection.MorePagesAvailable)
if (pagedCollection!= null && !pagedCollection.MorePagesAvailable)
{
usersList.AddRange(pagedCollection.CurrentPage.ToList());
}
Expand Down

0 comments on commit f1b2c80

Please sign in to comment.