Added check requestPath != null

If you try to load the AEM http://localhost:4502/projects.html (author instance) with Sling Dynamic Include bundle enabled you will get a nullPointerException because the resourcepath of projects.html is null.