Skip to content

Commit

Permalink
Fix null pointer crash when final is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
GuLinux committed Nov 7, 2022
1 parent d2495a2 commit 0904368
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v1.0.9
## 07/11/2022

1. [](#bugfix)
* Fix null pointer when no revision is marked as final


# v1.0.8
## 18/10/2022

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Astrobin
version: 1.0.8
version: 1.0.9
description: "This plugin provides astrobin shortcodes for images and galleries"
icon: picture-o
author:
Expand Down
9 changes: 5 additions & 4 deletions classes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function __construct($info, $api)
$revision_obj = $api->request($revision, [], false);
array_push($this->revisions, $revision_obj);
}
// $this->grav['log']->info(print_r($this->revisions, true));
// dump($this);
}

Expand Down Expand Up @@ -60,11 +61,11 @@ public function url($format, $revision_type="final", $animated=false) {

}
}
if(is_null($revision_obj)) {
$revision_obj = $this->revisions[0];
}

}
if(is_null($revision_obj)) {
$revision_obj = $this->revisions[0];
}
// dump($revision_obj);
$url = $revision_obj->{'url_' . $format};
if($animated) {
$url .= '?animated';
Expand Down

0 comments on commit 0904368

Please sign in to comment.