Protect against invalid HOME variable

Fixes https://gitlab.com/kicad/code/kicad/issues/6990
This commit is contained in:
Seth Hillbrand 2021-01-07 15:13:34 -08:00
parent c3d46c1cb5
commit 1e4d81e3c4
1 changed files with 8 additions and 0 deletions

View File

@ -215,6 +215,14 @@ bool PGM_BASE::InitPgm()
wxInitAllImageHandlers();
#ifndef __WINDOWS__
if( wxString( wxGetenv( "HOME" ) ).IsEmpty() )
{
DisplayErrorMessage( nullptr, _( "Environmental variable HOME is empty. Unable to continue." ) );
return false;
}
#endif
m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) +
wxGetUserId(), GetKicadLockFilePath() );