Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4016776
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:46:53+00:00 2026-05-20T09:46:53+00:00

I have searched and searched for a solution to this problem, but it seems

  • 0

I have searched and searched for a solution to this problem, but it seems no-one else is experiencing it. Here’s a description:

I’m creating a tile-based game with some co-programmers. We use a database class to do any and all loading of files and images. Everything works out just wonderfully until my Mac suddenly throws a NullPointerException at my face. The weird thing is it works on another dude’s Mac (same model and everything) and it worked just fine on my computer a few minutes before the error. Nothing has been changed in the meantime.

This has happened before, and back then I re-installed the OS which sorted the problem, so it sounds like a tweak in either Eclipse (which I’m using as IDE) or MacOS. Anyone got any ideas?

The project can be found on:
https://github.com/Gadamagaska/Quantum-Man

My stack-trace:

Exception in thread "main" java.lang.NullPointerException
    at entities.Level.getTile(Level.java:24)
    at database.Database.getTile(Database.java:206)
    at core.FoffyMain.drawBottomTiles(FoffyMain.java:82)
    at core.FoffyMain.draw(FoffyMain.java:64)
    at core.Core.gameLoop(Core.java:58)
    at core.Core.run(Core.java:34)
    at core.FoffyMain.main(FoffyMain.java:28)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:46:54+00:00Added an answer on May 20, 2026 at 9:46 am

    you could have checks like this

    public int getTile(int layer, int x, int y){
        if(layers!=null && layers.length > layer && layers[layer].length > y && layers[layer][y].length > x)
        {
            return layers[layer][y][x];
        }
        return -1;
    }
    

    or simple handle the null pointer exception

    public int getTile(int layer, int x, int y) {
        try{
    
        return layers[layer][y][x];
        }
        catch(NullPointerException npe)
        {
            return -1;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched around, and it seems that this is a limitation in MS
I've have searched on this and it seems to be a catch all, unfortunately
I've searched for this a little but I have not gotten a particularly straight
I have searched on this forum and haven't been able to find a solution
I have searched but apparently my google foo is weak. What I need is
OK, struggling to get a definitive answer to this one... I have an application
I have searched the web for days now but I can't seem to find
I have searched this site for an answer and found many responses to unsigned/signed
i have searched a lot but could not find the exact way to do
How one can add a menubar to a wx.grid frame? I have searched a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.