Skip to content

Commit

Permalink
Turns out, the bug is in our wrapper class. Not supposed to return nu…
Browse files Browse the repository at this point in the history
…llptr when attribute not found. Don't know why this is an issue _now_
  • Loading branch information
carlos-zamora committed Jan 22, 2020
1 parent ea22c8f commit bcfc522
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/cascadia/TerminalControl/XamlUiaTextRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ namespace XamlAutomation

namespace winrt::Microsoft::Terminal::TerminalControl::implementation
{
// EmptyObject is our equivalent of UIAutomationCore::UiaGetReservedNotSupportedValue()
// This retrieves a value that is interpreted as "not supported".
class EmptyObject : public winrt::implements<EmptyObject, IInspectable>

This comment has been minimized.

Copy link
@DHowett-MSFT

DHowett-MSFT Jan 22, 2020

Contributor

this only needs to be in the cpp file, not the header 😄

{
public:
static IInspectable GetInstance()
{
static auto eo = make_self<EmptyObject>();

This comment has been minimized.

Copy link
@DHowett-MSFT

DHowett-MSFT Jan 22, 2020

Contributor

better names

return eo.as<IInspectable>();

This comment has been minimized.

Copy link
@DHowett-MSFT

DHowett-MSFT Jan 22, 2020

Contributor

you can just *eo

}
};

XamlAutomation::ITextRangeProvider XamlUiaTextRange::Clone() const
{
UIA::ITextRangeProvider* pReturn;
Expand Down Expand Up @@ -88,7 +100,9 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
}
else
{
return nullptr;
// We _need_ to return an empty object here.
// Returning nullptr is an improper implementation of it being unsupported.
return EmptyObject::GetInstance();//*EmptyObject::GetInstance();
}
}

Expand Down

0 comments on commit bcfc522

Please sign in to comment.