Skip to content

Commit

Permalink
[SideSheet] Removed the hasValue check for shapeAppearance to guarant…
Browse files Browse the repository at this point in the history
…ee it always has a user value or default value to avoid NPE.

Resolves #3322

PiperOrigin-RevId: 522114031
  • Loading branch information
pekingme authored and paulfthomas committed Apr 10, 2023
1 parent 5bc7a50 commit 5e427da
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,20 @@ private void setSheetEdge(@NonNull V view, int layoutDirection) {

private void setSheetEdge(@SheetEdge int sheetEdge) {
if (sheetDelegate == null || sheetDelegate.getSheetEdge() != sheetEdge) {
ShapeAppearanceModel.Builder builder = shapeAppearanceModel.toBuilder();
if (sheetEdge == EDGE_RIGHT) {
this.sheetDelegate = new RightSheetDelegate(this);
if (!hasRightMargin()) {
if (shapeAppearanceModel != null && !hasRightMargin()) {
ShapeAppearanceModel.Builder builder = shapeAppearanceModel.toBuilder();
builder.setTopRightCornerSize(0).setBottomRightCornerSize(0);
updateMaterialShapeDrawable(builder.build());
}
return;
} else if (sheetEdge == EDGE_LEFT) {
}

if (sheetEdge == EDGE_LEFT) {
this.sheetDelegate = new LeftSheetDelegate(this);
if (!hasLeftMargin()) {
if (shapeAppearanceModel != null && !hasLeftMargin()) {
ShapeAppearanceModel.Builder builder = shapeAppearanceModel.toBuilder();
builder.setTopLeftCornerSize(0).setBottomLeftCornerSize(0);
updateMaterialShapeDrawable(builder.build());
}
Expand Down

0 comments on commit 5e427da

Please sign in to comment.