Protect access to frames array

Signed-off-by: Jorge Ruesga <jorge@ruesga.com>