Protect from an NPE if we find no graphics yet at sprite initialization time.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@106 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2006-12-20 20:05:09 +00:00
parent 45c75b5039
commit 71259f2ceb
@@ -255,10 +255,12 @@ public class ButtonSprite extends Sprite
// lay out the label if not already // lay out the label if not already
if (!_label.isLaidOut()) { if (!_label.isLaidOut()) {
Graphics2D gfx = _mgr.createGraphics(); Graphics2D gfx = _mgr.createGraphics();
try { if (gfx != null) {
_label.layout(gfx); try {
} finally { _label.layout(gfx);
gfx.dispose(); } finally {
gfx.dispose();
}
} }
} }