mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Adds a Unit Test for the Resource object in Java. Fixes a bug in the Resource class caused by allocating a negative resource value.
Change-Id: I3a3b368d429dc5cd00baf94ccd80a676a10cbb48
This commit is contained in:
@@ -86,7 +86,7 @@ public class Resource {
|
||||
* @throws CheckedAllocationException If there are no resources available to be allocated.
|
||||
*/
|
||||
public int allocate(final int index) throws CheckedAllocationException {
|
||||
if (index >= m_size) {
|
||||
if (index >= m_size || index < 0) {
|
||||
throw new CheckedAllocationException("Index " + index + " out of range");
|
||||
}
|
||||
if (m_numAllocated[index] == true) {
|
||||
|
||||
Reference in New Issue
Block a user