Have get_arg never return null
90% of places assume it will never return null, and they will break in weird ways if it does return null
This commit is contained in:
@ -39,10 +39,15 @@ class ShimmieApi extends Extension
|
||||
$page->set_type("text/plain");
|
||||
|
||||
if ($event->page_matches("api/shimmie/get_tags")) {
|
||||
$tag = $event->get_arg(0);
|
||||
if (empty($tag) && isset($_GET['tag'])) {
|
||||
if($event->count_args() > 0) {
|
||||
$tag = $event->get_arg(0);
|
||||
}
|
||||
elseif (isset($_GET['tag'])) {
|
||||
$tag = $_GET['tag'];
|
||||
}
|
||||
else {
|
||||
$tag = null;
|
||||
}
|
||||
$res = $this->api_get_tags($tag);
|
||||
$page->set_data(json_encode($res));
|
||||
} elseif ($event->page_matches("api/shimmie/get_image")) {
|
||||
|
Reference in New Issue
Block a user