I simply added a check for nullptr and seems it is enough.
Index: librecad/src/ui/dock_widgets/views_list/lc_namedviewslistwidget.cpp
==================================================================
--- librecad/src/ui/dock_widgets/views_list/lc_namedviewslistwidget.cpp
+++ librecad/src/ui/dock_widgets/views_list/lc_namedviewslistwidget.cpp
@@ -129,14 +129,16 @@
void LC_NamedViewsListWidget::setGraphicView(RS_GraphicView* gv, QMdiSubWindow* w) {
LC_ViewList* viewsList = nullptr;
if (gv != nullptr) {
RS_Graphic *graphic = gv->getGraphic();
- linearFormat = graphic->getLinearFormat();
- precision = graphic->getLinearPrecision();
- drawingUnit = graphic->getUnit();
- viewsList = graphic->getViewList();
+ if (graphic != nullptr) {
+ linearFormat = graphic->getLinearFormat();
+ precision = graphic->getLinearPrecision();
+ drawingUnit = graphic->getUnit();
+ viewsList = graphic->getViewList();
+ }
}
graphicView = gv;
window = w;
setViewsList(viewsList);
}