Fixed warning for uninitialized index.

Many thanks to Tobias Oetterer for reporting this bug.

Change-Id: I49c62e9979925acc312d386958d1e53eba3bf5a0