From 9dca07758ff17e8eeca9fa18dd6a0727f26b3bd9 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Fri, 28 Jan 2011 13:04:38 +0300 Subject: SONAR-2148: Fix NPE in JavaUtils --- sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java b/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java index 26ee5d17425..abbc8a5fa48 100644 --- a/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java +++ b/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java @@ -68,10 +68,16 @@ public final class JavaUtils { } public static String getSourceVersion(Project project) { - return project.getConfiguration().getString(JAVA_SOURCE_PROPERTY); + if (project.getConfiguration() != null) { + return project.getConfiguration().getString(JAVA_SOURCE_PROPERTY); + } + return null; } public static String getTargetVersion(Project project) { - return project.getConfiguration().getString(JAVA_TARGET_PROPERTY); + if (project.getConfiguration() != null) { + return project.getConfiguration().getString(JAVA_TARGET_PROPERTY); + } + return null; } } -- cgit v1.2.3