From d159c5e8c3290f87e6a651a342e662e8ef716ff6 Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Mon, 14 Mar 2011 19:45:35 +0000 Subject: [PATCH] Throw a more meaningful exception for a missing font than the NPE that's about to happen otherwise. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@6982 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/niftygui/com/jme3/niftygui/RenderFontJme.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/src/niftygui/com/jme3/niftygui/RenderFontJme.java b/engine/src/niftygui/com/jme3/niftygui/RenderFontJme.java index 0bfef504c..41182de9e 100644 --- a/engine/src/niftygui/com/jme3/niftygui/RenderFontJme.java +++ b/engine/src/niftygui/com/jme3/niftygui/RenderFontJme.java @@ -52,6 +52,9 @@ public class RenderFontJme implements RenderFont { public RenderFontJme(String name, NiftyJmeDisplay display) { this.display = display; font = display.getAssetManager().loadFont(name); + if (font == null) { + throw new RuntimeException( "Font not loaded:" + name ); + } text = new BitmapText(font); actualSize = font.getPreferredSize(); text.setSize(actualSize);