[GRASS-dev] help porting GRASS-RaPlaT to GRASS7

Glynn Clements glynn at gclements.plus.com
Tue Nov 8 03:11:14 EST 2011


Dylan Beaudette wrote:

> Here is what I get:

> #5  0xb7f799db in Rast_get_cellhd (name=0x0, mapset=0x804c228 "PERMANENT", cellhd=0xbffff198) at get_cellhd.c:62

name=0x0 means that the first argument to Rast_get_cellhd() (i.e. the
map name) is a null pointer.

I suspect that this is because the LOS_map= option wasn't specified. 
Although this option is marked as "required = NO", the code assumes
that it will be set (and generates a fatal error if the specified map
cannot be found).

I would expect similar behaviour with the original, unmodified code.

[Also, note that 7.0 doesn't allow the use of upper-case letters in
option names. Specifically, it won't recognise a name=value argument
as an option if the name part contains upper-case letters.]

If an option is always required, the ->required field in the option
structure should be set to YES (this is done automatically for
G_define_standard_option(G_OPT_R_INPUT)).

If an option isn't required, either it should have a default value
(i.e. the ->answer field should be set when defining the option) or
the code should explicitly check whether ->answer is null before
attempting to use its value.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list