Skip to content

Commit

Permalink
More comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kagamma committed Dec 30, 2024
1 parent fe98434 commit b0c315c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ui.partitions.format.pas
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ function ShowFormatDialog(const PPart: PPartedPartition; const AData: PPartedOpD
DataOld: TPartedOpDataFormat;
begin
Result := False;

// The following code should not run because the format button should be disabled for these cases
if PPart^.IsMounted then // Prevent user to perform format operation on a mounted partition
begin
MsgBox(Format(S_PartitionIsMounted, [PPart^.GetPartitionPath]), nil, mfInformation + mfOKButton);
Expand Down
3 changes: 3 additions & 0 deletions src/ui.partitions.labelname.pas
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ function ShowLabelNameDialog(const PPart: PPartedPartition; const AData: PParted
DataOld: TPartedOpDataLabel;
begin
Result := False;

// The following code should not run because the label button should be disabled for this case
if PPart^.Number = 0 then
begin
MsgBox(Format(S_PartitionIsUnallocated, []), nil, mfInformation + mfOKButton);
Exit;
end;

Desktop^.GetExtent(R);
MX := R.B.X div 2;
MY := R.B.Y div 2;
Expand Down

0 comments on commit b0c315c

Please sign in to comment.