diff --git a/lib/HttpInput.php b/lib/HttpInput.php index 60f3b48d..ece627a9 100644 --- a/lib/HttpInput.php +++ b/lib/HttpInput.php @@ -22,7 +22,7 @@ class HttpInput{ } public static function RequestType(): int{ - return preg_match('/\btext\/html\b/ius', $_SERVER['HTTP_ACCEPT']) ? WEB : REST; + return preg_match('/\btext\/html\b/ius', $_SERVER['HTTP_ACCEPT'] ?? '') ? WEB : REST; } public static function Str(string $type, string $variable, bool $allowEmptyString = true, string $default = null): ?string{ diff --git a/lib/PollVote.php b/lib/PollVote.php index 3105f7a2..d34ddfcf 100644 --- a/lib/PollVote.php +++ b/lib/PollVote.php @@ -46,10 +46,16 @@ class PollVote extends PropertiesBase{ if($this->PollItem === null){ $error->Add(new Exceptions\InvalidPollException()); } - } - - if(!$this->PollItem->Poll->IsActive()){ - $error->Add(new Exceptions\PollClosedException()); + else{ + if($this->PollItem->Poll === null){ + $error->Add(new Exceptions\InvalidPollException()); + } + else{ + if(!$this->PollItem->Poll->IsActive()){ + $error->Add(new Exceptions\PollClosedException()); + } + } + } } if(!$error->HasExceptions){