File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Generals/Code/Libraries/Source/WWVegas/WW3D2
GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2 Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -669,7 +669,8 @@ void DazzleRenderObjClass::Init_Type(const DazzleInitClass& i)
669
669
unsigned new_count=i.type +1 ;
670
670
DazzleTypeClass** new_types=W3DNEWARRAY DazzleTypeClass*[new_count];
671
671
unsigned a=0 ;
672
- for (;a<type_count;++a) {
672
+ unsigned copy_count = min (type_count, new_count);
673
+ for (;a<copy_count;++a) {
673
674
new_types[a]=types[a];
674
675
}
675
676
for (;a<new_count;++a) {
@@ -693,7 +694,8 @@ void DazzleRenderObjClass::Init_Lensflare(const LensflareInitClass& i)
693
694
unsigned new_count=i.type +1 ;
694
695
LensflareTypeClass** new_lensflares=W3DNEWARRAY LensflareTypeClass*[new_count];
695
696
unsigned a=0 ;
696
- for (;a<lensflare_count;++a) {
697
+ unsigned copy_count = min (lensflare_count, new_count);
698
+ for (;a<copy_count;++a) {
697
699
new_lensflares[a]=lensflares[a];
698
700
}
699
701
for (;a<new_count;++a) {
Original file line number Diff line number Diff line change @@ -685,7 +685,8 @@ void DazzleRenderObjClass::Init_Type(const DazzleInitClass& i)
685
685
unsigned new_count=i.type +1 ;
686
686
DazzleTypeClass** new_types=W3DNEWARRAY DazzleTypeClass*[new_count];
687
687
unsigned a=0 ;
688
- for (;a<type_count;++a) {
688
+ unsigned copy_count = min (type_count, new_count);
689
+ for (;a<copy_count;++a) {
689
690
new_types[a]=types[a];
690
691
}
691
692
for (;a<new_count;++a) {
@@ -709,7 +710,8 @@ void DazzleRenderObjClass::Init_Lensflare(const LensflareInitClass& i)
709
710
unsigned new_count=i.type +1 ;
710
711
LensflareTypeClass** new_lensflares=W3DNEWARRAY LensflareTypeClass*[new_count];
711
712
unsigned a=0 ;
712
- for (;a<lensflare_count;++a) {
713
+ unsigned copy_count = min (lensflare_count, new_count);
714
+ for (;a<copy_count;++a) {
713
715
new_lensflares[a]=lensflares[a];
714
716
}
715
717
for (;a<new_count;++a) {
You can’t perform that action at this time.
0 commit comments