# Cursed WonderGlade

**URL:** <https://discourse.codecombat.com/t/cursed-wonderglade/9053>\
**Category:** Bugs\
**Created:** [September 24, 2016, 4:32pm UTC](https://discourse.codecombat.com/t/cursed-wonderglade/9053 "2016-09-24T16:32:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lobsaang](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lobsaang](https://discourse.codecombat.com/u/Lobsaang)\
**Post date:** [September 24, 2016, 4:32pm UTC](https://discourse.codecombat.com/t/cursed-wonderglade/9053/1 "2016-09-24T16:32:09Z")

</div>

I’m not sure if it’s bug in level or I did something wrong in code because when i press start hero doing everything fine and level is accomplished but in code lines i got pop out that there it TypeError: Cannot read property ‘type’ of null while i defined it.

 ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/ac50e99a2c63c234682a9de779ddb0ba14ce767c.png)

---

<div class="post-metadata">

**Author:** ![htrnblr](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@htrnblr](https://discourse.codecombat.com/u/htrnblr)\
**Post date:** [September 24, 2016, 5:14pm UTC](https://discourse.codecombat.com/t/cursed-wonderglade/9053/2 "2016-09-24T17:14:55Z")

</div>

At the time of execution  
Parts of cycles  
The item does not exist  
Accordingly, the type of non-existent item can not be read

Add a check for the existence of item

---

<div class="post-metadata">

**Author:** ![Lobsaang](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lobsaang](https://discourse.codecombat.com/u/Lobsaang)\
**Post date:** [September 24, 2016, 5:33pm UTC](https://discourse.codecombat.com/t/cursed-wonderglade/9053/3 "2016-09-24T17:33:18Z")

</div>

So I have to add variable for item after else to be read yes?

---

<div class="post-metadata">

**Author:** ![htrnblr](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@htrnblr](https://discourse.codecombat.com/u/htrnblr)\
**Post date:** [September 24, 2016, 5:55pm UTC](https://discourse.codecombat.com/t/cursed-wonderglade/9053/4 "2016-09-24T17:55:22Z")

</div>

Use “and” logical operator  
At the line 12

if item exist AND if type of item not gem

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [September 26, 2016, 1:28pm UTC](https://discourse.codecombat.com/t/cursed-wonderglade/9053/5 "2016-09-26T13:28:40Z")

</div>

In early levels (Wonderglade for example) you’ve met the concept how to check the existence of items/enemies.

```python
var item = hero.findNearestItem();
if (item) {
    // item here
...

```

Have you solved levels before or jumped at this level by direct URL?

---

<div class="post-metadata">

**Author:** ![Lobsaang](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lobsaang](https://discourse.codecombat.com/u/Lobsaang)\
**Post date:** [September 26, 2016, 1:33pm UTC](https://discourse.codecombat.com/t/cursed-wonderglade/9053/6 "2016-09-26T13:33:02Z")

</div>

I solved level with and without fixing this problem, anyway thanks you all for help.  
But i think game gets sometimes too easy when you got bit too good equipment and you can just with simple code lanes solve it when game wants you to think and make it more complicated to use all you have learned 😕

Ps. Never thought about skiping levels by direct url.
