woo-j / OkapiBarcode

Open-source barcode encoding program written in Java
http://www.okapibarcode.org.uk
Apache License 2.0
318 stars 94 forks source link

NullPointerException while using ChannelCode #94

Closed karstenw-ro closed 2 years ago

karstenw-ro commented 2 years ago

Since updating to Okapi 0.3.3 Channel Codes always throw an NPE, this did not occur in version 0.3.2.

Source:

import uk.org.okapibarcode.backend.ChannelCode;

public class ChannelcodeNPE {
    public static  void main(String[] args) {
        ChannelCode cc = new ChannelCode();
        cc.setContent("123456");
    }
}

Stacktrace:

Exception in thread "main" java.lang.NullPointerException
    at uk.org.okapibarcode.backend.Symbol.plotSymbol(Symbol.java:657)
    at uk.org.okapibarcode.backend.Symbol.setContent(Symbol.java:530)
    at ChannelcodeNPE.main(ChannelcodeNPE.java:6)
gredler commented 2 years ago

Thanks for the bug report! Ironic that we had 15+ tests for various different scenarios, but none for this most basic of use cases.