diff --git a/devices/common/scsi/scsibus.cpp b/devices/common/scsi/scsibus.cpp index 1703af3..cc56337 100644 --- a/devices/common/scsi/scsibus.cpp +++ b/devices/common/scsi/scsibus.cpp @@ -286,12 +286,22 @@ int ScsiBus::target_xfer_data() { void ScsiBus::target_next_step() { - this->devices[this->target_id]->next_step(); + if (target_id < 0) { + LOG_F(ERROR, "%s: target_id is not set yet.", this->get_name().c_str()); + } + else { + this->devices[this->target_id]->next_step(); + } } bool ScsiBus::negotiate_xfer(int& bytes_in, int& bytes_out) { - this->devices[this->target_id]->prepare_xfer(this, bytes_in, bytes_out); + if (target_id < 0) { + LOG_F(ERROR, "%s: target_id is not set yet.", this->get_name().c_str()); + } + else { + this->devices[this->target_id]->prepare_xfer(this, bytes_in, bytes_out); + } return true; }