Good , I remembered that there were some "queer" disk mappings,
Though in this case it is OK, I mean if the partition/format commands are "hardcoded" to "disk 0" and the "check" prevents the partition/format to take place if the USB stick is disk 0, the only risk maybe that of formatting another disk in case of multi-disk system, but I don't think (unless some BIOS/UEFI mess with mixed MBR/GPT styles, which I never read about) that internal disk can be exchanged in case of "inserting" a USB device (unless they are exhanged in firmware intentionally by the user).
I mean, normal operation:
Disk 0 is first and boot disk
Disk 1 is second disk
Usb booting of a PE (via F12 or similar):
Disk 0 remains first disk <- the detection routine allows the partitioning/formatting
Disk 1 remains second disk
USB device is boot disk
Usb booting of a PE (changing boot order in BIOS or UEFI) or for whatever reason:
Usb becomes Disk 0 <- the detection routine prevents the accidental partitioning/formatting
Disk 0 is now Disk 1
Disk 1 is now Disk 2
There is not a case:
Disk 0 is now Disk 1
Disk 1 is now Disk 0 <- the detection routine allows the accidental partitioning/formatting of the "wrong" disk (though still not the USB one)
USB device is boot disk
right?
Wonko