Skip to content

Commit 1fe403b

Browse files
windows: check if OrientationSelector is found
1 parent 4553ba5 commit 1fe403b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

windows/RCTPdf/RCTPdfControl.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,11 @@ namespace winrt::RCTPdf::implementation
557557

558558
void RCTPdfControl::SetOrientation(bool horizontal) {
559559
m_horizontal = horizontal;
560-
FindName(winrt::to_hstring("OrientationSelector")).try_as<StackPanel>().Orientation(m_horizontal ? Orientation::Horizontal : Orientation::Vertical);
560+
StackPanel orientationSelector;
561+
if (FindName(winrt::to_hstring("OrientationSelector")).try_as<StackPanel>(orientationSelector))
562+
{
563+
orientationSelector.Orientation(m_horizontal ? Orientation::Horizontal : Orientation::Vertical);
564+
}
561565
}
562566

563567
winrt::IAsyncAction RCTPdfControl::RenderVisiblePages(int page) {

0 commit comments

Comments
 (0)