This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Hydrotronics's profile picture

Java.lang.NullPointerException

Started by Hydrotronics, 28 October 2016 - 01:38 PM
Hydrotronics #1
Posted 28 October 2016 - 03:38 PM
So this is the error I'm getting with my code.
My code is designed to add a series of functions that enable you to run programs across multiple screens.

So far, I wrote a function which allows you to draw images from paintutils.loadImage() across multiple screens.
This has worked with most monitor sizes, but with an 8x4 screen it throws "Java.lang.NullPointerException"

This is what I have called:

mov.draw("test",11,11,"monitor_1","monitor_2")

Could you help me understand where this is coming from?

Thanks in advance!
TYKUHN2 #2
Posted 28 October 2016 - 08:13 PM
Sounds like a bug. Scan through the known bug list for your version of ComputerCraft.
KingofGamesYami #3
Posted 28 October 2016 - 08:34 PM
It could be related to term.redirect. But I wouldn't expect that result.
Bomb Bloke #4
Posted 29 October 2016 - 02:20 AM
It could be related to term.redirect.

That's my guess - line 34 attempts to redirect to "restore", which may well be a nil value. It, and line 37, could be re-written to read as:

if restore then term.redirect(restore) else term.restore() end

I'm also not much liking the logic of line 18 - why add t1y and t2y, given that your monitors can only touch along one edge at a time?
jakejakey #5
Posted 13 November 2016 - 02:15 PM
-snip-
What I feel you are trying to accomplish here is very tedious, I don't recommend you keep redirecting around between terms. Just wrap one as a peripheral and then make your own drawing function to draw the square