im[i] = input[k++];
}
+ fftSize = Math.Max(fftSize, 0);
var L = fftSize;
var M = fftSize >> 1;
var S = fftSize - 1;
blendShapeCounts,
blendShapeKeyFormat);
_isInitialized = true;
+ v.Dispose();
}
catch (Exception)
{
{
string result = value.ToString();
FieldInfo info = typeof(T).GetField(result);
- var attributes = info.GetCustomAttributes(typeof(DescriptionAttribute), true);
+ var attributes = info?.GetCustomAttributes(typeof(DescriptionAttribute), true);
if (null != attributes?.FirstOrDefault() && attributes?.First() as DescriptionAttribute is var firstAttribute && firstAttribute != null)
{
result = firstAttribute.Description;
swigDelegate6 = null;
swigDelegate7 = null;
- Interop.WidgetImpl.DirectorConnect(SwigCPtr, null, null, null, null, null, null, null, null);
+ Interop.WidgetImpl.DirectorConnect(SwigCPtr, null, null, null, null, null, null, null, null);
}
private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes)
{
global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null);
- bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(WidgetImpl));
+ bool hasDerivedMethod = false;
+ if (methodInfo != null)
+ {
+ hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(WidgetImpl));
+ }
return hasDerivedMethod;
}
}
//if the value is not assignable and there's an implicit conversion, convert
- if (value != null && !toType.IsAssignableFrom(value.GetType()))
+ if (value != null && toType!= null && !toType.IsAssignableFrom(value.GetType()))
{
var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
if (string.IsNullOrEmpty(xaml))
throw new XamlParseException(string.Format("No embeddedresource found for {0}", path), new XmlLineInfo());
Type type = typeof(T);
- T ret = (T)type.Assembly.CreateInstance(type.FullName);
+ T ret = (T)type.Assembly.CreateInstance(type.FullName) ?? default(T);
NameScopeExtensions.PushElement(ret);
//part of the legacy as well...
static string ReadResourceAsXaml(Type type, Assembly assembly, string likelyTargetName, bool validate = false)
{
- using (var stream = assembly.GetManifestResourceStream(likelyTargetName))
- using (var reader = new StreamReader(stream))
+ using var stream = assembly.GetManifestResourceStream(likelyTargetName);
+ if (stream != null)
{
+ using var reader = new StreamReader(stream);
if (validate)
{
// terrible validation of XML. Unfortunately it will probably work most of the time since comments
}
//if the value is not assignable and there's an implicit conversion, convert
- if (value != null && !toType.IsAssignableFrom(value.GetType()))
+ if (value != null && toType != null && !toType.IsAssignableFrom(value.GetType()))
{
var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
?? GetImplicitConversionOperator(toType, value.GetType(), toType);
NUILog.Debug($"[AnimatedVectorImageView START[ [{GetId()}] RepeatCount SET");
repeatCnt = (value < -1) ? -1 : value;
- LoopCount = (repeatCnt < 0) ? repeatCnt : repeatCnt + 1;
+ if (repeatCnt < 0)
+ {
+ LoopCount = repeatCnt;
+ }
+ else
+ {
+ if (repeatCnt < int.MaxValue)
+ {
+ LoopCount = repeatCnt + 1;
+ }
+ else
+ {
+ LoopCount = int.MaxValue;
+ }
+ }
NUILog.Debug($"[{GetId()}] repeatCnt={repeatCnt} ]AnimatedVectorImageView END]");
}
foreach (System.Attribute attr in attrs)
{
// If the Scriptable attribute exists, then register it with the type registry.
- if (attr is ScriptableProperty)
+ // first get the attribute type, ( default, or animatable)
+ if (attr is ScriptableProperty scriptableProp)
{
NUILog.Debug("Got a DALi JSON scriptable property = " + propertyInfo.Name + ", of type " + propertyInfo.PropertyType.Name);
- // first get the attribute type, ( default, or animatable)
- ScriptableProperty scriptableProp = attr as ScriptableProperty;
-
// we get the start property index, based on the type and it's hierarchy, e.g. DateView (70,000)-> Spin (60,000) -> View (50,000)
int propertyIndex = propertyRangeManager.GetPropertyIndex(viewType.ToString(), viewType, scriptableProp.type);
if (view != null)
{
// call the get property function
- System.Object val = view.GetType().GetProperty(propertyName).GetAccessors()[0].Invoke(view, null);
+ System.Object val = view.GetType().GetProperty(propertyName)?.GetAccessors()[0].Invoke(view, null);
PropertyValue value = PropertyValue.CreateFromObject(val);
IntPtr ptr = (IntPtr)PropertyValue.getCPtr(value);
{
System.Reflection.PropertyInfo propertyInfo = view.GetType().GetProperty(propertyName);
// We know the property name, we know it's type, we just need to convert from a DALi property value to native C# type
- System.Type type = propertyInfo.PropertyType;
+ System.Type type = propertyInfo?.PropertyType;
bool ok = false;
if (type.Equals(typeof(Int32)))
{
global::System.IntPtr cPtr = Interop.FocusManager.Get();
- if(cPtr == global::System.IntPtr.Zero)
+ if (cPtr == global::System.IntPtr.Zero)
{
NUILog.ErrorBacktrace("FocusManager.Instance called before Application created, or after Application terminated!");
}
focusChangingEventHandler?.Invoke(this, e);
- if (originallyProposed != e.Proposed)
+ if (originallyProposed != e.Proposed && e.Proposed != null)
{
//when user has changed Proposed
return e.Proposed.GetPtrfromView();
return null;
}
Type type = Type.GetType("Tizen.NUI." + parts[0]);
- return ConvertFrom(type, parts[1], null);
+ return type == null ? null : ConvertFrom(type, parts[1], null);
}
BindableProperty ConvertFrom(Type type, string propertyName, IXmlLineInfo lineinfo)