https://github.com/Tencent/TscanCode
We use TscanCode to make our project robust.
If there are errors, we have to fix them.
For example:
BehaviorSource.cs line="76" msg="comparing [mTaskData] to null at line 73 implies that [mTaskData] might be null.Dereferencing null pointer [mTaskData]"
I fixed it by moving “mTaskData != null &&” ahead. TscanCode didn't report the error.
Am I right?
There are other errors in Behavior Designer. Could you please scan and fix them?
We use TscanCode to make our project robust.
If there are errors, we have to fix them.
For example:
BehaviorSource.cs line="76" msg="comparing [mTaskData] to null at line 73 implies that [mTaskData] might be null.Dereferencing null pointer [mTaskData]"
C#:
public bool CheckForSerialization(bool force, BehaviorSource behaviorSource = null)
{
// mark the non-external behavior tree version as serialized since that property will change.
bool hasSerialized = (behaviorSource != null ? behaviorSource.HasSerialized : HasSerialized);
if (!hasSerialized || force) {
if (behaviorSource != null) {
behaviorSource.HasSerialized = true;
} else {
HasSerialized = true;
}
if (mTaskData != null && !string.IsNullOrEmpty(mTaskData.JSONSerialization)) {
JSONDeserialization.Load(mTaskData, behaviorSource == null ? this : behaviorSource);
} else { // binary serialization
BinaryDeserialization.Load(mTaskData, behaviorSource == null ? this : behaviorSource);
}
return true;
}
return false;
}
C#:
public bool CheckForSerialization(bool force, BehaviorSource behaviorSource = null)
{
// mark the non-external behavior tree version as serialized since that property will change.
bool hasSerialized = (behaviorSource != null ? behaviorSource.HasSerialized : HasSerialized);
if (mTaskData != null && (!hasSerialized || force)) {
if (behaviorSource != null) {
behaviorSource.HasSerialized = true;
} else {
HasSerialized = true;
}
if (!string.IsNullOrEmpty(mTaskData.JSONSerialization)) {
JSONDeserialization.Load(mTaskData, behaviorSource == null ? this : behaviorSource);
} else { // binary serialization
BinaryDeserialization.Load(mTaskData, behaviorSource == null ? this : behaviorSource);
}
return true;
}
return false;
}
There are other errors in Behavior Designer. Could you please scan and fix them?
Last edited: