1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Further avoid use of null pointer.

This commit is contained in:
Thomas Harte 2022-08-31 16:03:01 -04:00
parent df29a50738
commit acc82546c4

View File

@ -55,6 +55,8 @@ bool DirectAccessDevice::write(const Target::CommandState &state, Target::Respon
}
bool DirectAccessDevice::read_capacity(const Target::CommandState &, Target::Responder &responder) {
if(!device_) return false;
const auto final_block = device_->get_number_of_blocks() - 1;
const auto block_size = device_->get_block_size();
std::vector<uint8_t> data = {
@ -81,6 +83,8 @@ Target::Executor::Inquiry DirectAccessDevice::inquiry_values() {
}
bool DirectAccessDevice::format_unit(const Target::CommandState &, Target::Responder &responder) {
if(!device_) return false;
// Formatting: immediate.
responder.terminate_command(Target::Responder::Status::Good);
return true;