fixes #4737 null pointer exception after adding new relation content

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