-
- gMapCanvas.width = viewportWidth;
- gMapCanvas.height = viewportHeight;
- gTrackCanvas.width = viewportWidth;
- gTrackCanvas.height = viewportHeight;
- drawMap();
- showUI();
+ if (gMapCanvas && gTrackCanvas) {
+ gMapCanvas.width = viewportWidth;
+ gMapCanvas.height = viewportHeight;
+ gTrackCanvas.width = viewportWidth;
+ gTrackCanvas.height = viewportHeight;
+ drawMap();
+ showUI();
+ }