Make the core patch fix work for Gridelements without rows as well

Change-Id: If175c6fbfa926fa1827fe12e348d4bf6ab3db207