Added validation for zero Id on parsing parameters

fonts_experiment
Valeriy Mironov 2017-11-23 11:26:26 +02:00
parent 15f58054d0
commit af3d324fae
1 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using NLog;
@ -91,6 +92,9 @@ namespace WatchFace.Models
var id = (byte) ((rawId & 0xf8) >> 3);
var flags = (ParameterFlags) (rawId & 0x7);
if (id == 0)
throw new ArgumentException("Parameter with zero Id is invalid.");
var value = ReadValue(fileStream);
if (flags.HasFlag(ParameterFlags.HasChildren))
{