From ddd4178c629b2516510d8fc324fa4d7d6a793ca7 Mon Sep 17 00:00:00 2001
From: jean-pierre charras <jp.charras@wanadoo.fr>
Date: Wed, 8 Feb 2023 08:38:31 +0100
Subject: [PATCH] PL editor: Add ( missing in commit 0d903d43) test for invalid
 parameter.

---
 pagelayout_editor/dialogs/properties_frame.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pagelayout_editor/dialogs/properties_frame.cpp b/pagelayout_editor/dialogs/properties_frame.cpp
index eb5efabaaa..5170468998 100644
--- a/pagelayout_editor/dialogs/properties_frame.cpp
+++ b/pagelayout_editor/dialogs/properties_frame.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2013 CERN
- * Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2021-2023 KiCad Developers, see AUTHORS.txt for contributors.
  * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
  *
  * This program is free software; you can redistribute it and/or
@@ -180,11 +180,13 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
     DS_DATA_MODEL&   model = DS_DATA_MODEL::GetTheInstance();
 
     // Import default parameters from widgets
-    m_defaultLineWidth.Validate( 0.0, 10.0, EDA_UNITS::MILLIMETRES );
-    model.m_DefaultLineWidth = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
+    bool is_valid = m_defaultLineWidth.Validate( 0.0, 10.0, EDA_UNITS::MILLIMETRES );
+
+    if( is_valid )
+        model.m_DefaultLineWidth = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
                                                                m_defaultLineWidth.GetValue() );
 
-    bool is_valid = m_defaultTextSizeX.Validate( DLG_MIN_TEXTSIZE, DLG_MAX_TEXTSIZE,
+    is_valid = m_defaultTextSizeX.Validate( DLG_MIN_TEXTSIZE, DLG_MAX_TEXTSIZE,
                                                  EDA_UNITS::MILLIMETRES );
     if( is_valid )
         model.m_DefaultTextSize.x = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,