Skip to content

Commit 8580374

Browse files
author
Andrew Omondi
committed
adds nullable checks.
1 parent 329c3e8 commit 8580374

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Kiota.Builder/KiotaBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,10 +955,10 @@ x.Parent is CodeIndexer ||
955955

956956
Parallel.ForEach(unmappedRequestBuilderTypes, parallelOptions, x =>
957957
{
958-
var parentClass = x.Parent?.Parent as CodeClass;
959958
var parentNS = x.Parent?.Parent?.Parent as CodeNamespace;
959+
CodeClass[] exceptions = x.Parent?.Parent is CodeClass parentClass ? [parentClass] : [];
960960
x.TypeDefinition = parentNS?.FindChildrenByName<CodeClass>(x.Name)
961-
.Except([parentClass]).OfType<CodeClass>() // the property method should not reference itself as a return type.
961+
.Except(exceptions)// the property method should not reference itself as a return type.
962962
.MinBy(shortestNamespaceOrder);
963963
// searching down first because most request builder properties on a request builder are just sub paths on the API
964964
if (x.TypeDefinition == null)

0 commit comments

Comments
 (0)