Skip to content

Commit

Permalink
Add fallback if QI on agile reference fails. (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
manodasanW authored Jul 29, 2021
1 parent 3507d24 commit cfc26e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/WinRT.Runtime/ObjectReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,11 @@ ObjectReference<T> CreateForCurrentContext(IntPtr _)
using var referenceInContext = agileReference.Get();
if (_iid == Guid.Empty)
{
return referenceInContext.As<T>();
return referenceInContext.TryAs<T>(out var objRef) >= 0 ? objRef : null;
}
else
{
return referenceInContext.As<T>(_iid);
return referenceInContext.TryAs<T>(_iid, out var objRef) >= 0 ? objRef : null;
}
}
}
Expand Down

0 comments on commit cfc26e5

Please sign in to comment.