Fix null check order in SendableRegistry (#2314)

This commit is contained in:
Thad House
2020-01-27 19:43:31 -08:00
committed by Peter Johnson
parent 3bcf8057d4
commit 068465146b

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -338,10 +338,10 @@ public class SendableRegistry {
return null;
}
Object rv = null;
if (handle < comp.m_data.length) {
rv = comp.m_data[handle];
} else if (comp.m_data == null) {
if (comp.m_data == null) {
comp.m_data = new Object[handle + 1];
} else if (handle < comp.m_data.length) {
rv = comp.m_data[handle];
} else {
comp.m_data = Arrays.copyOf(comp.m_data, handle + 1);
}