Skip to content

Commit

Permalink
Add some fallbacks if the data is not available
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed May 30, 2020
1 parent a1a6dd9 commit 490d731
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libraries/classes/Navigation/NavigationTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ public function __construct($template, $dbi)
// Get the active node
if (isset($_REQUEST['aPath'])) {
$this->aPath[0] = $this->parsePath($_REQUEST['aPath']);
$this->pos2Name[0] = $_REQUEST['pos2_name'];
$this->pos2Value[0] = (int) $_REQUEST['pos2_value'];
$this->pos2Name[0] = $_REQUEST['pos2_name'] ?? '';
$this->pos2Value[0] = (int) $_REQUEST['pos2_value'] ?? 0;
if (isset($_REQUEST['pos3_name'])) {
$this->pos3Name[0] = $_REQUEST['pos3_name'];
$this->pos3Value[0] = $_REQUEST['pos3_value'];
$this->pos3Name[0] = $_REQUEST['pos3_name'] ?? '';
$this->pos3Value[0] = (int) $_REQUEST['pos3_value'] ?? 0;
}
} else {
if (isset($_POST['n0_aPath'])) {
Expand Down
4 changes: 4 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,10 @@
<PossiblyNullArgument occurrences="1">
<code>$title</code>
</PossiblyNullArgument>
<TypeDoesNotContainType occurrences="2">
<code>(int) $_REQUEST['pos2_value']</code>
<code>(int) $_REQUEST['pos3_value']</code>
</TypeDoesNotContainType>
</file>
<file src="libraries/classes/Navigation/NodeFactory.php">
<LessSpecificReturnStatement occurrences="1">
Expand Down

0 comments on commit 490d731

Please sign in to comment.