The problem was the draw function tried to use the material and gpsettings and both were NULL. Now, the default material is used.
The problem was the draw function tried to use the material and gpsettings and both were NULL. Now, the default material is used.