Skip to content

Commit 0d08f0d

Browse files
committed
Main_Window: fixed possible dereferencing pointer and increase priority bit mask
1 parent 67a5212 commit 0d08f0d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/Main_Window.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@ void Main_Window::Update_VM_Port_Number()
16671667

16681668
void Main_Window::Update_Info_Text( int info_mode )
16691669
{
1670-
Virtual_Machine *tmp_vm = Get_Current_VM();
1670+
auto* tmp_vm = Get_Current_VM();
16711671

16721672
if( tmp_vm == NULL && info_mode == 0 )
16731673
{
@@ -2502,6 +2502,8 @@ QString Main_Window::Get_Current_Binary_Name()
25022502

25032503
bool Main_Window::Boot_Is_Correct( Virtual_Machine *tmp_vm )
25042504
{
2505+
if (!tmp_vm)
2506+
return false;
25052507
// Floppy A
25062508
if( tmp_vm->Get_FD0().Get_Enabled() )
25072509
{
@@ -4188,7 +4190,9 @@ void Main_Window::on_TB_Show_Architecture_Options_Window_clicked()
41884190

41894191
void Main_Window::Discard_Changes(QDialog* dialog)
41904192
{
4191-
auto old_vm = Get_Current_VM();
4193+
auto* old_vm = Get_Current_VM();
4194+
if (!old_vm)
4195+
return;
41924196
Virtual_Machine old_vm_copy(*old_vm);
41934197
Virtual_Machine tmp_vm;
41944198
bool ok = Create_VM_From_Ui(&tmp_vm, old_vm, false);
@@ -4239,7 +4243,11 @@ void Main_Window::on_TB_Show_SMP_Settings_Window_clicked()
42394243
else
42404244
{
42414245
// Settings changed?
4242-
if( SMP_Settings->Get_Values() != Get_Current_VM()->Get_SMP() )
4246+
auto* old_vm = Get_Current_VM();
4247+
if (!old_vm)
4248+
return;
4249+
4250+
if( SMP_Settings->Get_Values() != old_vm->Get_SMP() )
42434251
VM_Changed();
42444252
}
42454253
}

src/VM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ bool Virtual_Machine::Create_VM_File( const QString &file_name, bool template_mo
16471647

16481648
// Storage Devices
16491649
if( Get_Current_Emulator_Devices()->PSO_Drive &&
1650-
(template_mode == false || (template_mode == true && Template_Opts & Create_Template_Window::Template_Save_HDD)) )
1650+
(template_mode == false || (template_mode == true && (Template_Opts & Create_Template_Window::Template_Save_HDD))) )
16511651
{
16521652
// Storage Device Count
16531653
Dom_Element = New_Dom_Document.createElement( "Storage_Device_Count" );

0 commit comments

Comments
 (0)