mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 03:58:28 +00:00
check for data before instancing anything
This commit is contained in:
+4
-4
@@ -105,14 +105,14 @@ class QRCode{
|
||||
public function setData($data, QROptions $options = null){
|
||||
$data = trim($data);
|
||||
|
||||
if(!$options instanceof QROptions){
|
||||
$options = new QROptions;
|
||||
}
|
||||
|
||||
if(empty($data)){
|
||||
throw new QRCodeException('No data given.');
|
||||
}
|
||||
|
||||
if(!$options instanceof QROptions){
|
||||
$options = new QROptions;
|
||||
}
|
||||
|
||||
if(!array_key_exists($options->errorCorrectLevel, QRConst::RSBLOCK)){
|
||||
throw new QRCodeException('Invalid error correct level: '.$options->errorCorrectLevel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user