Re: [Vala] functions and null
- From: Anatol Pomozov <anatol pomozov gmail com>
- To: Pavol Klačanský <pavol klacansky com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] functions and null
- Date: Wed, 19 Jan 2011 13:16:15 -0800
2011/1/19 Pavol Klačanský <pavol klacansky com>:
Hi, why this code doesn't work
Here the item is null
Item item = null;
parse_content(item);
And in this function you declared parameter as non-null
parse_content(Item item) {
stderr.printf("argh");
}
reports
** (process:674): CRITICAL **: xml_parser_parse_content: assertion
`item != NULL' failed
Unlike Java and other languages Vala has idea of nullable references.
You should declare your function as
parse_content(Item? item) {
pay attention to the question mark after the parameter type.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]