Explorar o código

ensure postmessage data is a string #1143

Hakim El Hattab %!s(int64=10) %!d(string=hai) anos
pai
achega
ea735f0a2f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      js/reveal.js

+ 1 - 1
js/reveal.js

@@ -795,7 +795,7 @@
 				var data = event.data;
 
 				// Make sure we're dealing with JSON
-				if( data.charAt( 0 ) === '{' && data.charAt( data.length - 1 ) === '}' ) {
+				if( typeof data === 'string' && data.charAt( 0 ) === '{' && data.charAt( data.length - 1 ) === '}' ) {
 					data = JSON.parse( data );
 
 					// Check if the requested method can be found