Fix null ptr exception in getReadingLevelScale()

Handle the case where WebView settings might be null.

Bug: 5472493
Change-Id: I6b1c2e5e5e56a517910a330ae9d40a4adc99d75a
This commit is contained in:
Mangesh Ghiware
2011-10-18 09:32:36 -07:00
parent 9a7e4ce72a
commit 1698d45ef8

View File

@@ -314,7 +314,10 @@ class ZoomManager {
* Returns the zoom scale used for reading text on a double-tap.
*/
public final float getReadingLevelScale() {
return mDisplayDensity * mWebView.getSettings().getDoubleTapZoom() / 100.0f;
WebSettings settings = mWebView.getSettings();
final float doubleTapZoomFactor = settings != null
? settings.getDoubleTapZoom() / 100.f : 1.0f;
return mDisplayDensity * doubleTapZoomFactor;
}
public final float getInvDefaultScale() {