diff --git a/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java b/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java
index <HASH>..<HASH> 100644
--- a/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java
+++ b/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java
@@ -525,7 +525,7 @@ public class SpringLoadedPreProcessor implements Constants {
 		} else {

 			try {

 				CodeSource codeSource = protectionDomain.getCodeSource();

-				if (codeSource.getLocation() == null) {

+				if (codeSource == null || codeSource.getLocation() == null) {

 					if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.WARNING)) {

 						log.warning("null codesource for " + slashedClassName);

 					}
Check for null codeSource before attempting to access
codeSource.getLocation()