Skip to content

Commit 56dc80c

Browse files
authored
Merge pull request #599 from microsoftgraph/bugfix/collection-npe-nocontent
- fixes an issue where receiving no content responses for collections would cause an NPE
2 parents be9ac2a + a3c567e commit 56dc80c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/com/microsoft/graph/http/BaseCollectionPage.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// ------------------------------------------------------------------------------
22
// Copyright (c) 2017 Microsoft Corporation
3-
//
3+
//
44
// Permission is hereby granted, free of charge, to any person obtaining a copy
55
// of this software and associated documentation files (the "Software"), to deal
66
// in the Software without restriction, including without limitation the rights
77
// to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
88
// copies of the Software, and to permit persons to whom the Software is
99
// furnished to do so, subject to the following conditions:
10-
//
10+
//
1111
// The above copyright notice and this permission notice shall be included in
1212
// all copies or substantial portions of the Software.
13-
//
13+
//
1414
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1515
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -26,6 +26,7 @@
2626
import com.microsoft.graph.serializer.AdditionalDataManager;
2727
import com.microsoft.graph.serializer.ISerializer;
2828

29+
import java.util.ArrayList;
2930
import java.util.Collections;
3031
import java.util.List;
3132

@@ -68,7 +69,7 @@ public abstract class BaseCollectionPage<T1, T2 extends IRequestBuilder> impleme
6869
public BaseCollectionPage(final List<T1> pageContents, final T2 nextRequestBuilder) {
6970
// CollectionPages are never directly modifiable, either 'update'/'delete' the specific child or 'add' the new
7071
// object to the 'children' of the collection.
71-
this.pageContents = Collections.unmodifiableList(pageContents);
72+
this.pageContents = Collections.unmodifiableList(pageContents == null ? new ArrayList<T1>() : pageContents);
7273
requestBuilder = nextRequestBuilder;
7374
}
7475

0 commit comments

Comments
 (0)