Nullptr safety. (Sentry KICAD-4F)

This commit is contained in:
Jeff Young 2023-01-18 01:16:57 +00:00
parent f90b04c715
commit f399dc0c3a
4 changed files with 8 additions and 10 deletions

View File

@ -492,7 +492,7 @@ void DS_DRAW_ITEM_LIST::BuildDrawItemsList( const PAGE_INFO& aPageInfo,
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance(); DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
m_titleBlock = &aTitleBlock; m_titleBlock = &aTitleBlock;
m_paperFormat = &aPageInfo.GetType(); m_paperFormat = aPageInfo.GetType();
// Build the basic layout shape, if the layout list is empty // Build the basic layout shape, if the layout list is empty
if( model.GetCount() == 0 && !model.VoidListAllowed() ) if( model.GetCount() == 0 && !model.VoidListAllowed() )

View File

@ -156,12 +156,12 @@ wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
} }
else if( token->IsSameAs( wxT( "PAPER" ) ) ) else if( token->IsSameAs( wxT( "PAPER" ) ) )
{ {
*token = m_paperFormat ? *m_paperFormat : wxString( "" ); *token = m_paperFormat;
tokenUpdated = true; tokenUpdated = true;
} }
else if( token->IsSameAs( wxT( "LAYER" ) ) ) else if( token->IsSameAs( wxT( "LAYER" ) ) )
{ {
*token = m_sheetLayer ? *m_sheetLayer : wxString( "" ); *token = m_sheetLayer;
tokenUpdated = true; tokenUpdated = true;
} }
else if( m_titleBlock ) else if( m_titleBlock )

View File

@ -391,9 +391,7 @@ public:
m_penSize = 1; m_penSize = 1;
m_pageNumber = "1"; m_pageNumber = "1";
m_sheetCount = 1; m_sheetCount = 1;
m_sheetLayer = nullptr;
m_titleBlock = nullptr; m_titleBlock = nullptr;
m_paperFormat = nullptr;
m_project = nullptr; m_project = nullptr;
m_isFirstPage = true; m_isFirstPage = true;
m_properties = nullptr; m_properties = nullptr;
@ -421,7 +419,7 @@ public:
/** /**
* Set the paper format name (mainly for drawing sheet editor) * Set the paper format name (mainly for drawing sheet editor)
*/ */
void SetPaperFormat( const wxString* aFormatName ) { m_paperFormat = aFormatName; } void SetPaperFormat( const wxString& aFormatName ) { m_paperFormat = aFormatName; }
/** /**
* Set the filename to draw/plot * Set the filename to draw/plot
@ -441,7 +439,7 @@ public:
/** /**
* Set the sheet layer to draw/plot * Set the sheet layer to draw/plot
*/ */
void SetSheetLayer( const wxString& aSheetLayer ) { m_sheetLayer = &aSheetLayer; } void SetSheetLayer( const wxString& aSheetLayer ) { m_sheetLayer = aSheetLayer; }
void SetDefaultPenSize( int aPenSize ) { m_penSize = aPenSize; } void SetDefaultPenSize( int aPenSize ) { m_penSize = aPenSize; }
int GetDefaultPenSize() const { return m_penSize; } int GetDefaultPenSize() const { return m_penSize; }
@ -550,12 +548,12 @@ protected:
int m_sheetCount; ///< The number of sheets int m_sheetCount; ///< The number of sheets
// for text variable references, in schematic // for text variable references, in schematic
const TITLE_BLOCK* m_titleBlock; // for text variable references const TITLE_BLOCK* m_titleBlock; // for text variable references
const wxString* m_paperFormat; // for text variable references wxString m_paperFormat; // for text variable references
wxString m_fileName; // for text variable references wxString m_fileName; // for text variable references
wxString m_sheetName; // for text variable references wxString m_sheetName; // for text variable references
wxString m_sheetPath; // for text variable references wxString m_sheetPath; // for text variable references
wxString m_pageNumber; ///< The actual page number displayed in the title block. wxString m_pageNumber; ///< The actual page number displayed in the title block.
const wxString* m_sheetLayer; // for text variable references wxString m_sheetLayer; // for text variable references
const PROJECT* m_project; // for project-based text variable references const PROJECT* m_project; // for project-based text variable references
const std::map<wxString, wxString>* m_properties; // for text variable references const std::map<wxString, wxString>* m_properties; // for text variable references

View File

@ -98,7 +98,7 @@ void PL_DRAW_PANEL_GAL::DisplayDrawingSheet()
// To show the formatted texts instead of raw texts in drawing sheet editor, we need // To show the formatted texts instead of raw texts in drawing sheet editor, we need
// a dummy DS_DRAW_ITEM_LIST. // a dummy DS_DRAW_ITEM_LIST.
DS_DRAW_ITEM_LIST dummy; DS_DRAW_ITEM_LIST dummy;
dummy.SetPaperFormat( &m_edaFrame->GetPageSettings().GetType() ); dummy.SetPaperFormat( m_edaFrame->GetPageSettings().GetType() );
dummy.SetTitleBlock( &m_edaFrame->GetTitleBlock() ); dummy.SetTitleBlock( &m_edaFrame->GetTitleBlock() );
dummy.SetProject( &m_edaFrame->Prj() ); dummy.SetProject( &m_edaFrame->Prj() );
dummy.SetMilsToIUfactor( drawSheetIUScale.IU_PER_MILS ); dummy.SetMilsToIUfactor( drawSheetIUScale.IU_PER_MILS );