Skip to content

Commit

Permalink
Fixed panic when schema field name is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
serejja committed Sep 22, 2015
1 parent 4885c69 commit a6c785f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,11 @@ func parseRecordSchema(v map[string]interface{}, registry map[string]Schema, nam
func parseSchemaField(i interface{}, registry map[string]Schema, namespace string) (*SchemaField, error) {
switch v := i.(type) {
case map[string]interface{}:
schemaField := &SchemaField{Name: v[schema_nameField].(string)}
name, ok := v[schema_nameField].(string)
if !ok {
return nil, fmt.Errorf("Schema field name missing")
}
schemaField := &SchemaField{Name: name}
setOptionalField(&schemaField.Doc, v, schema_docField)
fieldType, err := schemaByType(v[schema_typeField], registry, namespace)
if err != nil {
Expand Down

0 comments on commit a6c785f

Please sign in to comment.