Fix crash in solvespace-cli
`window` is a `nullptr` with guinone.cpp - avoid dereferencing it. Fixes: https://github.com/solvespace/solvespace/issues/567pull/517/head^2
parent
3ea8ebfaf5
commit
6558cb9ebe
13
src/draw.cpp
13
src/draw.cpp
|
@ -305,9 +305,16 @@ void GraphicsWindow::GroupSelection() {
|
|||
|
||||
Camera GraphicsWindow::GetCamera() const {
|
||||
Camera camera = {};
|
||||
window->GetContentSize(&camera.width, &camera.height);
|
||||
camera.pixelRatio = window->GetDevicePixelRatio();
|
||||
camera.gridFit = (window->GetDevicePixelRatio() == 1);
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue