SemanticMediaWiki/SemanticResultFormats

$node variable never set

YOUR1 opened this issue · 4 comments

YOUR1 commented

The $node variable in GraphPrinter


is not necessarily always set. Causing Fatal errors like:

[b21f02e9ee840c16d267cc9b] /index.php/Overzicht_RDA-klassen Error from line 190 of /var/platform/cores/1.35/20221104-1230/extensions/SemanticResultFormats/src/Graph/GraphPrinter.php: Call to a member function addField() on null

Backtrace:
#0 /var/platform/cores/1.35/20221104-1230/extensions/SemanticResultFormats/src/Graph/GraphPrinter.php(141): SRF\Graph\GraphPrinter->processResultRow(array)
#1 /var/platform/cores/1.35/20221104-1230/extensions/SemanticMediaWiki/src/Query/ResultPrinters/ResultPrinter.php(341): SRF\Graph\GraphPrinter->getResultText(SMW\Query\QueryResult, integer)
#2 /var/platform/cores/1.35/20221104-1230/extensions/SemanticMediaWiki/src/Query/ResultPrinters/ResultPrinter.php(306): SMW\Query\ResultPrinters\ResultPrinter->buildResult(SMW\Query\QueryResult)
#3 /var/platform/cores/1.35/20221104-1230/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(348): SMW\Query\ResultPrinters\ResultPrinter->getResult(SMW\Query\QueryResult, array, integer)
#4 /var/platform/cores/1.35/20221104-1230/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(364): SMWQueryProcessor::getResultFromQuery(SMWQuery, array, integer, integer)
#5 /var/platform/cores/1.35/20221104-1230/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(196): SMW\ParserFunctions\AskParserFunction->doFetchResultsFromFunctionParameters(array, array)
#6 /var/platform/cores/1.35/20221104-1230/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(402): SMW\ParserFunctions\AskParserFunction->parse(array)``` 

@alex-mashin you touched that in #676

I presume, to get this error, one has to either suppress the main result column or move it from the first place, so that some non-page property becomes the first?

The code assumed that '?' is the first printout.

Can be closed now.