|
Re: java.lang.NullPointerException
The issue is that when your subsystems are initialized, they get their values for all the RobotMap variables before those variables have been initialized. So you can either
- Initialize subsystems after calling RobotMap.init(); or
- Call RobotMap.init() in a static block in the RobotMap class; or
- Remove RobotMap.init() altogether and initialize its contents inline
What you're basically doing is:
Code:
Object a = null;
Object b = a; // set b to the _current_ value of a, which is null
a = new Object();
...
b.doSomething(); // null pointer exception!
__________________
WPILib
GRIP, RobotBuilder
Last edited by SamCarlberg : 17-01-2017 at 22:16.
|