fixes #4652 NullPonterException when click on Dynamic Plugins portlet

Fixed the issue and pushed the code for review, please check it.