Fix crash in solvespace-cli

`window` is a `nullptr` with guinone.cpp - avoid dereferencing it.

Fixes: https://github.com/solvespace/solvespace/issues/567
pull/517/head^2
ruevs 2020-10-16 23:35:40 +03:00 committed by phkahler
parent 3ea8ebfaf5
commit 6558cb9ebe
1 changed files with 10 additions and 3 deletions

View File

@ -305,9 +305,16 @@ void GraphicsWindow::GroupSelection() {
Camera GraphicsWindow::GetCamera() const {
Camera camera = {};
if(window) {
window->GetContentSize(&camera.width, &camera.height);
camera.pixelRatio = window->GetDevicePixelRatio();
camera.gridFit = (window->GetDevicePixelRatio() == 1);
} else { // solvespace-cli
camera.width = 297.0; // A4? Whatever...
camera.height = 210.0;
camera.pixelRatio = 1.0;
camera.gridFit = camera.pixelRatio == 1.0;
}
camera.offset = offset;
camera.projUp = projUp;
camera.projRight = projRight;