diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81d65ac..b97df54 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
+
+# [2.0.1](https://github.com/flextype-plugins/icon/compare/v2.0.0...v2.0.1) (2021-01-07)
+
+### Bug Fixes
+
+* **core** fix possible issue with null icon name.
+
-# [2.0.0](https://github.com/flextype-plugins/icon/compare/v1.7.0...v2.0.0) (2021-01-03)
+# [2.0.0](https://github.com/flextype-plugins/icon/compare/v1.7.0...v2.0.0) (2021-01-07)
### Features
diff --git a/README.md b/README.md
index a92ffb0..55eedac 100755
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ Global function `icon()`
/**
* Get SVG icon from specific icons set.
*
- * @param string $name Icon name.
+ * @param string|null $name Icon name.
* @param string|null $set Icon set:
* - tabler
* - bootstrap
@@ -54,7 +54,7 @@ Global function `icon()`
*
* @return string
*/
-function icon(string $name, ?string $set = 'fontawesome|solid', ?string $class = null): string
+function icon(?string $name = null, ?string $set = 'fontawesome|solid', ?string $class = null): string
```
### Usage
diff --git a/plugin.php b/plugin.php
index 8c6c405..ed5210e 100644
--- a/plugin.php
+++ b/plugin.php
@@ -17,7 +17,7 @@
/**
* Get SVG icon from specific icons set.
*
- * @param string $name Icon name.
+ * @param string|null $name Icon name.
* @param string|null $set Icon set:
* - tabler
* - bootstrap
@@ -28,7 +28,7 @@
*
* @return string
*/
-function icon(string $name, ?string $set = 'fontawesome|solid', ?string $class = null): string
+function icon(?string $name = null, ?string $set = 'fontawesome|solid', ?string $class = null): string
{
switch ($set) {
case 'tabler':
@@ -64,12 +64,12 @@ function icon(string $name, ?string $set = 'fontawesome|solid', ?string $class =
// Shortcode: [icon name="apple" set="fontawesome|brands" class=""]
flextype('parsers')->shortcode()->addHandler('icon', function (ShortcodeInterface $s) {
- return icon($s->getParameter('name'),
+ return icon(! is_null($s->getParameter('name')) ? $s->getParameter('name') : null,
! is_null($s->getParameter('set')) ? $s->getParameter('set') : null,
! is_null($s->getParameter('class')) ? $s->getParameter('class') : '');
});
// Twig: {{ icon('apple', 'fontawesome|brands', '') }}
-flextype('twig')->addFunction(new TwigFunction('icon', function (string $name, ?string $set = 'fontawesome|solid', ?string $class = null) {
+flextype('twig')->addFunction(new TwigFunction('icon', function (?string $name = null, ?string $set = 'fontawesome|solid', ?string $class = null) {
return icon($name, $set, $class);
}, ['is_safe' => ['html']]));