shevek/jcpp

NullPointerException when #endif is missing

Closed this issue · 2 comments

NullPointerException is thrown for source.setActive(true) in Preprocessor._token() when #endif is missing and #ifdef is satisfied.
Here is a simple test case:

#define D
#ifdef D
    int a = 1;
#else
    int a = 2;
<EOF>

Similarly for:

#ifndef D
    int a = 1;
#else
    int a = 2;
<EOF>

Thank you. I will fix this. (Lazy Shevek asks:) Do you have a junit case?

Didn't have findbugs back in the day. Slowly adding JSR305 annotations in the hope of rattling out this kind of bug.