gstvalue: Don't loop forever when serializing invalid flag
The serialization code would loop forever if an invalid flag was sent into it.
With unit test for this corner case.
The serialization code would loop forever if an invalid flag was sent into it.
With unit test for this corner case.