From f3576e54c6736c45950bfbe23960df016d1c6b6a Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Wed, 5 May 2010 18:44:12 +0000
Subject: [PATCH] throw IllegalStateException rather than NPE if no context

---
 apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java
index ffc77f71bb..785acce6d5 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java
@@ -19,6 +19,9 @@ public class CSSHelper extends HelperBase {
         if (userAgent != null && userAgent.contains("MSIE")) {
             url += FORCE + "/";
         } 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);
             url += theme + "/";
         }
-- 
GitLab