throw IllegalStateException rather than NPE if no context

This commit is contained in:
zzz
2010-05-05 18:44:12 +00:00
parent 0325f6c4d2
commit f3576e54c6

View File

@ -19,6 +19,9 @@ public class CSSHelper extends HelperBase {
if (userAgent != null && userAgent.contains("MSIE")) { if (userAgent != null && userAgent.contains("MSIE")) {
url += FORCE + "/"; url += FORCE + "/";
} else { } else {
// This is the first thing to use _context on most pages
if (_context == null)
throw new IllegalStateException("No contexts. This is usually because the router is either starting up or shutting down.");
String theme = _context.getProperty(PROP_THEME_NAME, DEFAULT_THEME); String theme = _context.getProperty(PROP_THEME_NAME, DEFAULT_THEME);
url += theme + "/"; url += theme + "/";
} }