Skip to content

Commit 962cbef

Browse files
Copilotanupriya13
andcommitted
Improve error handling in GetSystemWheelScrollLines helper
Co-authored-by: anupriya13 <54227869+anupriya13@users.noreply.github.com>
1 parent 2883f91 commit 962cbef

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

vnext/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ constexpr float c_scrollerLineDelta = 16.0f;
3131
// Helper function to get the Windows system setting for wheel scroll lines
3232
static int GetSystemWheelScrollLines() noexcept {
3333
UINT scrollLines = 3; // Default fallback value
34-
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0);
34+
if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0)) {
35+
// If the system call fails, use the default value
36+
scrollLines = 3;
37+
}
3538
return static_cast<int>(scrollLines);
3639
}
3740

0 commit comments

Comments
 (0)