cpp-134: NPE in Application#onCreate

Hopefully the problem is fixed

Fixes #134
This commit is contained in:
serso 2015-02-16 22:33:58 +01:00
parent 880343bba4
commit 1f8df36719

View File

@ -68,7 +68,7 @@ public class CalculatorApplication extends android.app.Application implements Sh
@Nonnull @Nonnull
static final String MAIL = "se.solovyev@gmail.com"; static final String MAIL = "se.solovyev@gmail.com";
private static final String TAG = "Calculator++ Application"; private static final String TAG = "C++";
public static final String AD_FREE_PRODUCT_ID = "ad_free"; public static final String AD_FREE_PRODUCT_ID = "ad_free";
public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free"; public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free";
@ -94,9 +94,6 @@ public class CalculatorApplication extends android.app.Application implements Sh
@Nonnull @Nonnull
private final Wizards wizards = new CalculatorWizards(this); private final Wizards wizards = new CalculatorWizards(this);
private final boolean withAds;
@Nonnull
private Typeface typeFace; private Typeface typeFace;
/* /*
@ -107,16 +104,10 @@ public class CalculatorApplication extends android.app.Application implements Sh
********************************************************************** **********************************************************************
*/ */
protected CalculatorApplication(boolean withAds) { public CalculatorApplication() {
this.withAds = withAds;
instance = this; instance = this;
} }
public CalculatorApplication() {
this(true);
}
/* /*
********************************************************************** **********************************************************************
* *
@ -192,8 +183,6 @@ public class CalculatorApplication extends android.app.Application implements Sh
Locator.getInstance().getLogger().debug(TAG, "Application started!"); Locator.getInstance().getLogger().debug(TAG, "Application started!");
Locator.getInstance().getNotifier().showDebugMessage(TAG, "Application started!"); Locator.getInstance().getNotifier().showDebugMessage(TAG, "Application started!");
typeFace = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf");
// we must update the widget when app starts // we must update the widget when app starts
App.getBroadcaster().sendEditorStateChangedIntent(); App.getBroadcaster().sendEditorStateChangedIntent();
} }
@ -230,6 +219,9 @@ public class CalculatorApplication extends android.app.Application implements Sh
@Nonnull @Nonnull
public Typeface getTypeFace() { public Typeface getTypeFace() {
if (typeFace == null) {
typeFace = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf");
}
return typeFace; return typeFace;
} }