File.store_line(jstr) causing error

Godot Version

4.2.1

Question

Keep getting an error stating “Attemp to call function store_line in base null instance on a null instance.” What am I doing wrong?

People won’t be able to help you unless you post the code that’s throwing that error.

Just uploaded a screenshot of the code.

As I can see from the screenshot the variable file is marked as null, it seems the file is not opened correctly.

How do I fix that?

Have you checked the value of SAVE_PATH ? Is it point to a valid path and file?

It is now, but now I’m gettin an unknown error on line 19. It doesn’t specify what the error is, it just says “breakpoint.”

A breakpoint is meant to stop the running of your program, you should remove the breakpoint if you don’t need it. Just click the red dot in front of your line 19.

I fixed it by replacing if not with if FileAccess.file_exists(SAVE_PATH) == false:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.