Description: NullPointerException in SideSheetBehavior setState > runAfterLayout, happens when viewRef was nullified as part of SideSheetBehavior.onDetachedFromLayoutParams() and only then accessed by setState() > runAfterLayout lambda. Similar nearby checks outside of lambda are not enough, as all of them are executed immediately, and access in lambda is done later, after layout.
Fix for the issue is in #4974
Screenshot of the problematic SideSheetBehavior.setState() code is attached below, line where viewRef is accessed without viewRef != null check is highlighted, viewRef was not null initially, during setState() call, but then SideSheetBehavior was detached from view, and only then view was layout and lambda with highlighted line of the already detached SideSheetBehavior was run
Android API version: 30-36
Material Library version: 1.13, but actually any