mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Updates the CANJaguar to free itself before throwing an exception in the constructor. This allows it to be allocated later without throwing an Allocation exception.
Change-Id: Ifbd15fecad92fa17a1c4b92d444b67221dacb4b5
This commit is contained in:
@@ -13,7 +13,6 @@ import java.nio.ByteOrder;
|
||||
import edu.wpi.first.wpilibj.can.CANExceptionFactory;
|
||||
import edu.wpi.first.wpilibj.can.CANJNI;
|
||||
import edu.wpi.first.wpilibj.can.CANMessageNotFoundException;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable;
|
||||
import edu.wpi.first.wpilibj.tables.ITable;
|
||||
import edu.wpi.first.wpilibj.tables.ITableListener;
|
||||
@@ -206,6 +205,8 @@ public class CANJaguar implements MotorSafety, PIDOutput, SpeedController, LiveW
|
||||
!m_receivedStatusMessage1 ||
|
||||
!m_receivedStatusMessage2 ||
|
||||
!receivedFirmwareVersion) {
|
||||
/* Free the resource */
|
||||
free();
|
||||
throw new CANMessageNotFoundException();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user