File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2123,17 +2123,21 @@ export class LinearGradient {
2123
2123
let stopsRef = null ;
2124
2124
if ( this . stops ) {
2125
2125
const CGFloatArray = interop . sizeof ( interop . types . id ) === 4 ? Float32Array : Float64Array ;
2126
- const buffer = CGFloatArray . from ( this . stops ) ;
2126
+ const buffer = CGFloatArray . from ( this . stops . map ( ( s ) => Math . max ( 0 , Math . min ( 1 , s ) ) ) ) ;
2127
2127
stopsRef = buffer ;
2128
2128
}
2129
2129
2130
2130
const cgColors = this . colors . map ( ( c ) => ( c instanceof Color ? c : new Color ( c ) ) . ios . CGColor ) ;
2131
2131
this . _gradient = CGGradientCreateWithColors ( CGColorSpaceCreateDeviceRGB ( ) , cgColors as any , stopsRef ) ;
2132
- CFRetain ( this . _gradient ) ;
2132
+ if ( this . _gradient ) {
2133
+ CFRetain ( this . _gradient ) ;
2134
+ }
2133
2135
} else {
2134
2136
const cgColors = [ this . colors , this . stops ] . map ( ( c ) => ( c instanceof Color ? c : new Color ( c ) ) . ios . CGColor ) ;
2135
2137
this . _gradient = CGGradientCreateWithColors ( CGColorSpaceCreateDeviceRGB ( ) , cgColors as any , null ) ;
2136
- CFRetain ( this . _gradient ) ;
2138
+ if ( this . _gradient ) {
2139
+ CFRetain ( this . _gradient ) ;
2140
+ }
2137
2141
}
2138
2142
}
2139
2143
return this . _gradient ;
You can’t perform that action at this time.
0 commit comments