Permalink
Browse files

Fix NPE seen when trying to verify TISTUD-1517

  • Loading branch information...
1 parent 61d1ede commit 01adb66c089573968734ab33e29028f2c0aee999 @sgtcoolguy sgtcoolguy committed Apr 18, 2012
Showing with 17 additions and 1 deletion.
  1. +17 −1 plugins/org.radrails.rails.ui/src/org/radrails/rails/internal/RailsServer.java
View
18 plugins/org.radrails.rails.ui/src/org/radrails/rails/internal/RailsServer.java
@@ -7,6 +7,7 @@
*/
package org.radrails.rails.internal;
+import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
@@ -17,6 +18,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -186,7 +188,21 @@ public int getPort()
public URI getDocumentRoot()
{
- return fProject.getLocation().append("public").toFile().toURI(); //$NON-NLS-1$
+ if (fProject == null)
+ {
+ return null;
+ }
+ IPath projectLocation = fProject.getLocation();
+ if (projectLocation == null)
+ {
+ return null;
+ }
+ File file = projectLocation.append("public").toFile(); //$NON-NLS-1$
+ if (file == null)
+ {
+ return null;
+ }
+ return file.toURI();
}
public URL getBaseURL()

0 comments on commit 01adb66

Please sign in to comment.