This site requires JavaScript, please enable it in your browser!
Greenfoot back
AbdulrazaqAS
AbdulrazaqAS wrote ...

2022/6/27

Throws an exception if not logged in

AbdulrazaqAS AbdulrazaqAS

2022/6/27

#
In my last scenario "Bomb Deactivation", if I run it while not logged in, it throws an exception; RuntimeException - (JavaScript) TypeError: C...(rest of the message is out of the screen). But it runs if I log in.
danpost danpost

2022/6/28

#
AbdulrazaqAS wrote...
In my last scenario "Bomb Deactivation", if I run it while not logged in, it throws an exception; RuntimeException - (JavaScript) TypeError: C...(rest of the message is out of the screen). But it runs if I log in.
Are you using the UserInfo class at all? If so, show all codes of and related in any way to the class and its values.
AbdulrazaqAS AbdulrazaqAS

2022/7/2

#
danpost wrote...
AbdulrazaqAS wrote...
In my last scenario "Bomb Deactivation", if I run it while not logged in, it throws an exception; RuntimeException - (JavaScript) TypeError: C...(rest of the message is out of the screen). But it runs if I log in.
Are you using the UserInfo class at all? If so, show all codes of and related in any way to the class and its values.
Yes i used it, but it's almost in three or more classes. Should i paste the classes here or i should just upload the whole scenario.
danpost danpost

2022/7/3

#
abdulrazaqAS wrote...
Should i paste the classes here or i should just upload the whole scenario.
Either way.
AbdulrazaqAS AbdulrazaqAS

2022/7/6

#
danpost wrote...
abdulrazaqAS wrote...
Should i paste the classes here or i should just upload the whole scenario.
Either way.
Hello, I have uploaded the scenario, all the following classes are using UserInfo class; Area, FirstScreen, Board and Bomb.
danpost danpost

2022/7/7

#
AbdulrazaqAS wrote...
I have uploaded the scenario, all the following classes are using UserInfo class; Area, FirstScreen, Board and Bomb.
Unfortunately, the UserInfo object may still be null even when storage is available. Therefore, after assigning the object to a variable using getMyInfo, check it for null before trying to work with the object (in each and every place you access it).
AbdulrazaqAS AbdulrazaqAS

2022/7/8

#
danpost wrote...
AbdulrazaqAS wrote...
I have uploaded the scenario, all the following classes are using UserInfo class; Area, FirstScreen, Board and Bomb.
Unfortunately, the UserInfo object may still be null even when storage is available. Therefore, after assigning the object to a variable using getMyInfo, check it for null before trying to work with the object (in each and every place you access it).
Ok, so it should be
if (UserInfo.isStorageAvailable()) {
        UserInfo myInfo = UserInfo.getMyInfo();
        if(myInfo != null){
            //...
        }
}
AbdulrazaqAS AbdulrazaqAS

2022/7/14

#
danpost wrote...
AbdulrazaqAS wrote...
I have uploaded the scenario, all the following classes are using UserInfo class; Area, FirstScreen, Board and Bomb.
Unfortunately, the UserInfo object may still be null even when storage is available. Therefore, after assigning the object to a variable using getMyInfo, check it for null before trying to work with the object (in each and every place you access it).
Thanks it works.
You need to login to post a reply.