[Coverity] Fix some possible divide by 0 cases

This commit is contained in:
baldurk
2016-09-14 18:27:13 +02:00
parent 361498a735
commit 3ce3fbe025
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -161,7 +161,7 @@ namespace renderdoc
// Get instance fields of the structure type.
FieldInfo[] fieldInfo = NonArrayType(field.FieldType).GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
int align = 0;
int align = 1;
foreach (FieldInfo f in fieldInfo)
align = Math.Max(align, AlignOf(f));
@@ -290,7 +290,7 @@ namespace renderdoc
long size = 0;
int a = 0;
int a = 1;
foreach (FieldInfo field in fieldInfo)
{
+1 -1
View File
@@ -58,7 +58,7 @@ namespace renderdocui.Windows
private int SliceForString(string s, UInt32 value, UInt32 maximum)
{
if (value == 0)
if (value == 0 || maximum == 0)
return 0;
float ratio = (float)value / maximum;