Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Exiting if null

Exiting if null

Put your problem here if it does not fit any of the other categories.

Exiting if null

Postby cuvimo » Wed Apr 13, 2011 7:23 pm

I'm scouring through an example project that's hosted on google and I'm constantly seeing a little snippet of code that's being used to exit a function if what's being passed in is null. Is there a better way to code this instead of placing this little snippet at the beginning of every function where that variable is used?

Snippet In Question:
Code: Select all
if (gl == null) {
    return;
}


Full Code:
Code: Select all
public void Init(GL10 gl) {
    if (gl == null) {
        return;
    }
    InitTex(gl, SLWP.Bg);
}


Thanks,
Brian
cuvimo
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Mar 25, 2011 8:41 pm

Top

Re: Exiting if null

Postby imbroken » Fri Apr 15, 2011 8:58 am

yes, throw an illegalArgumentException
imbroken
Senior Developer
Senior Developer
 
Posts: 131
Joined: Thu Jan 06, 2011 6:57 pm
Location: Germnay

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 8 guests