Commit d38d58b8 authored by Xi Han's avatar Xi Han Committed by Commit Bot

[Start] Add a null check of FeedStream in StartSurfaceMediator.

The crash was caused by registering a listener to a null feedStream.

Bug: 1127854
Change-Id: Ic040cf6620718e72b7f8a3faac115f7fb8799f34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2407093Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Commit-Queue: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807143}
parent 0a05fcf8
......@@ -335,15 +335,16 @@ class StartSurfaceMediator
mPropertyModel.get(FEED_SURFACE_COORDINATOR);
if (feedSurfaceCoordinator != null) {
Stream feedStream = feedSurfaceCoordinator.getStream();
assert feedStream != null;
feedStream.addOnContentChangedListener(() -> {
int firstCardDensity = feedStream.getFirstCardDensity();
if (firstCardDensity != Stream.FeedFirstCardDensity.UNKNOWN) {
StartSurfaceConfiguration.setFeedPlaceholderDense(
feedStream.getFirstCardDensity()
== Stream.FeedFirstCardDensity.DENSE);
}
});
if (feedStream != null) {
feedStream.addOnContentChangedListener(() -> {
int firstCardDensity = feedStream.getFirstCardDensity();
if (firstCardDensity != Stream.FeedFirstCardDensity.UNKNOWN) {
StartSurfaceConfiguration.setFeedPlaceholderDense(
feedStream.getFirstCardDensity()
== Stream.FeedFirstCardDensity.DENSE);
}
});
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment