Core/Grids: Fix possible crash