소스 검색

properly handle typed array constructors in VariantParser, closes #3054

Juan Linietsky 9 년 전
부모
커밋
725b61bb6c
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      core/variant_parser.cpp

+ 5 - 2
core/variant_parser.cpp

@@ -448,7 +448,7 @@ Error VariantParser::_parse_construct(Stream *p_stream,Vector<T>& r_construct,in
 		if (!first) {
 			get_token(p_stream,token,line,r_err_str);
 			if (token.type==TK_COMMA) {
-				//do none
+				//do none				
 			} else if (token.type==TK_PARENTHESIS_CLOSE) {
 				break;
 			} else {
@@ -458,7 +458,10 @@ Error VariantParser::_parse_construct(Stream *p_stream,Vector<T>& r_construct,in
 			}
 		}
 		get_token(p_stream,token,line,r_err_str);
-		if (token.type!=TK_NUMBER) {
+
+		if (first && token.type==TK_PARENTHESIS_CLOSE) {
+			break;
+		} else if (token.type!=TK_NUMBER) {
 			r_err_str="Expected float in constructor";
 			return ERR_PARSE_ERROR;
 		}