Workaround for $tag is not a object

I don't know why $tag is no object, but I did the following steps to produce this error:
1. Install Clip (for UI-Hook)
2. Install Tag
3. Remove standard tags and add one tag
4. Bind hook to Clip
5. Edit an existing entry
--> Loading failed with ```PHP Fatal error:  Call to a member function getTag() on a non-object in /my/path/to/Zikula/modules/Tag/lib/Tag/Entity/Repository/TagRepository.php on line 50, referer: https://myurl.net/myClip/url```

If I print (with print_r) $tags from line 42 I get the following:
```
Array(
    [0] => Array
        (
            [0] => 
            [freq] => 1
        )

    [1] => Array
        (
            [0] => 
            [freq] => 1
        )

    [2] => Array
        (
            [0] => Tag_Entity_Tag Object
                (
                    [id:Tag_Entity_Tag:private] => 4
                    [tag:Tag_Entity_Tag:private] => gäste
                    [slug:Tag_Entity_Tag:private] => gaste
                    [reflection:protected] => 
                )

            [freq] => 1
        )

)