V3095. The object was used before it was verified against null. Check lines: N1, N2.
V3095 The 'htmlLiElement' object was used before it was verified against null. Check lines: 916, 936. HtmlToXamlConverter.cs 916
private static XmlElement AddOrphanListItems(....)
{
Debug.Assert(htmlLiElement.LocalName.ToLower() == "li");
....
XmlNode htmlChildNode = htmlLiElement;
var htmlChildNodeName = htmlChildNode == null
? null
: htmlChildNode.LocalName.ToLower();
....
}
V3095 The 'this.linePoints' object was used before it was verified against null. Check lines: 332, 346. PathLine.cs 332
public override void Render(DrawArgs drawArgs)
{
....
if(this.linePoints.Length > 1) // <=
{
....
if(this.linePoints != null) // <=
{
....
}
}
....
}
Also see V3022
V3095 The 'node' object was used before it was verified against null. Check lines: 364, 365. ProjectContextMenu.cs 364
private void AddFolderItems(MergableMenu menu, string path)
{
....
DirectoryNode node = projectTree.SelectedNode
as DirectoryNode;
if (node.InsideClasspath == node)
menu.Add(RemoveSourcePath, 2, true);
else if (node != null && ....)
{
menu.Add(AddSourcePath, 2, false);
}
....
}
V3095 The 'uv2.gameObject' object was used before it was verified against null. Check lines: 1719, 1731. UnityEngine.Networking NetworkServer.cs 1719
static public bool SpawnObjects()
{
....
if (uv2.gameObject.hideFlags == HideFlags.NotEditable ||
uv2.gameObject.hideFlags == HideFlags.HideAndDontSave)
continue;
....
if (uv2.gameObject == null)
continue;
....
}
Similar errors can be found in some other places:
V3095 The 'diskRoots' object was used before it was verified against null. Check lines: 2656, 2659. ToolLocationHelper.cs 2656
private static void ExtractSdkDiskRootsFromEnvironment
(List<string> diskRoots, string directoryRoots)
{
if (!String.IsNullOrEmpty(directoryRoots))
{
....
diskRoots.AddRange(splitRoots); // <=
}
if (diskRoots != null) // <=
....
}
Similar errors can be found in some other places:
V3095 The 'data' object was used before it was verified against null. Check lines: 319, 376. GitCommands RevisionGraph.cs 319
void DataReceived(string data)
{
if (data.StartsWith(CommitBegin)) // <=
{
....
}
if (!string.IsNullOrEmpty(data))
{
....
}
}
Similar errors can be found in some other places:
V3095 The 'inputParameters' object was used before it was verified against null. Check lines: 430, 436. System.Management.Automation FormatViewGenerator_Complex.cs 430
internal ComplexViewEntry
GenerateView(....,
FormattingCommandLineParameters inputParameters)
{
_complexSpecificParameters =
(ComplexSpecificParameters)inputParameters.shapeParameters;
int maxDepth = _complexSpecificParameters.maxDepth;
....
if (inputParameters != null)
mshParameterList = inputParameters.mshParameterList;
....
}
V3095 The 'other.Parameters' object was used before it was verified against null. Check lines: 189, 192. System.Management.Automation CommandMetadata.cs 189
public CommandMetadata(CommandMetadata other)
{
....
_parameters = new Dictionary<string, ParameterMetadata>(
other.Parameters.Count, StringComparer.OrdinalIgnoreCase);
// deep copy
if (other.Parameters != null)
....
}
V3095 The 'Delegate' object was used before it was verified against null. Check lines: 37, 40. SerializableDelegate.cs 37
void ISerializable.GetObjectData(
SerializationInfo info,
StreamingContext context)
{
info.AddValue("delegateType", Delegate.GetType());
....
if (.... && Delegate != null)
{
....
}
}
Similar errors can be found in some other places:
V3095 The 'dataset' object was used before it was verified against null. Check lines: 48, 49. ImageCropperBaseExtensions.cs 48
internal static ImageCropData GetCrop(....)
{
var imageCropDatas = dataset.ToArray();
if (dataset == null || imageCropDatas.Any() == false)
return null;
....
}
Similar errors can be found in some other places:
V3095 The 'position' object was used before it was verified against null. Check lines: 204, 206. Task.cs 204
public void JumpToPosition()
{
if (hasLocation && !position.IsDeleted)
....
else if (position != null)
....
}
V3095 The 'result' object was used before it was verified against null. Check lines: 1292, 1294. VideoMetadataExtractor.cs 1292
public bool TryExtractMetadata(....)
{
using (Stream stream = fsra.OpenRead())
result.MimeType = MimeTypeDetector.GetMimeType(
stream, DEFAULT_MIMETYPE);
if (result != null) // <=
{
....
}
}
Similar errors can be found in some other places:
V3095 The 'VisualEnvironmentCompiler.RemoteCompiler' object was used before it was verified against null. Check lines: 52, 54. CompilerController CompilerControllerPlugin.cs 52
public CompilerController_VisualPascalABCPlugin(....)
{
....
VisualEnvironmentCompiler.RemoteCompiler.InternalDebug.
RunOnMono = CompilerInformation.cbRunMono.Checked;
....
if (VisualEnvironmentCompiler.RemoteCompiler != null)
....
}
Similar errors can be found in some other places:
V3095 CWE-476 The 'element' object was used before it was verified against null. Check lines: 101, 107. StyleContext.cs 101
public override void
OnBeginElementTest(VisualElement element, ....)
{
if (element.IsDirty(ChangeType.Styles))
{
....
}
if (element != null && element.styleSheets != null)
{
....
}
....
}
Similar errors can be found in some other places:
V3095 The 'quantiles' object was used before it was verified against null. Check lines: 91, 92. Runtime OuterQuantiles.cs 91
public static double GetQuantile(double probability,
double[] quantiles)
{
....
int n = quantiles.Length;
if (quantiles == null)
throw new ArgumentNullException(nameof(quantiles));
if (n == 0)
throw new ArgumentException("quantiles array is empty", nameof(quantiles));
....
}
V3095 [CWE-476] The 'conditionValues' object was used before it was verified against null. Check lines: 228, 238. AWSSDK.Core.Net45 JsonPolicyWriter.cs 228
private static void writeConditions(....)
{
....
foreach (....)
{
IList<string> conditionValues = keyEntry.Value;
if (conditionValues.Count == 0) // <=
continue;
....
if (conditionValues != null && conditionValues.Count != 0)
{
....
}
....
}
}
Similar errors can be found in some other places:
V3095 The 'context' object was used before it was verified against null. Check lines: 340, 346. Principal.cs 340
abstract public class Principal : IDisposable
{
....
public void Save(PrincipalContext context)
{
....
if ( context.ContextType == ContextType.Machine // <=
|| _ctx.ContextType == ContextType.Machine)
{
throw new InvalidOperationException(
SR.SaveToNotSupportedAgainstMachineStore);
}
if (context == null) // <=
{
Debug.Assert(this.unpersisted == true);
throw new InvalidOperationException(SR.NullArguments);
}
....
}
....
}
V3095 The 'propertyNames' object was used before it was verified against null. Check lines: 990, 1004. DirectoryEntry.cs 990
public class DirectoryEntry : Component
{
....
public void RefreshCache(string[] propertyNames)
{
....
object[] names = new object[propertyNames.Length]; // <=
for (int i = 0; i < propertyNames.Length; i++)
names[i] = propertyNames[i];
....
if (_propertyCollection != null && propertyNames != null) // <=
....
....
}
....
}
V3095 The 'outputStream' object was used before it was verified against null. Check lines: 654, 672. Icon.Windows.cs 654
public sealed partial class Icon :
MarshalByRefObject, ICloneable, IDisposable, ISerializable
{
....
public void Save(Stream outputStream)
{
if (_iconData != null)
{
outputStream.Write(_iconData, 0, _iconData.Length); // <=
}
else
{
....
if (outputStream == null) // <=
throw new ArgumentNullException("dataStream");
....
}
}
....
}
V3095 The 'seq' object was used before it was verified against null. Check lines: 880, 884. XmlQueryRuntime.cs 880
public IList<XPathNavigator> DocOrderDistinct(IList<XPathNavigator> seq)
{
if (seq.Count <= 1) // <=
return seq;
XmlQueryNodeSequence nodeSeq = (XmlQueryNodeSequence)seq; // <=
if (nodeSeq == null) // <=
nodeSeq = new XmlQueryNodeSequence(seq);
return nodeSeq.DocOrderDistinct(_docOrderCmp);
}
V3095 The 'other' object was used before it was verified against null. Check lines: 1095, 1096. XPathNodePointer.cs 1095
internal XmlNodeOrder ComparePosition(XPathNodePointer other)
{
RealFoliate();
other.RealFoliate();
Debug.Assert(other != null);
....
}
V3095 The 'buffer' object was used before it was verified against null. Check lines: 51, 53. HttpRequestStream.cs 51
public override IAsyncResult BeginRead(byte[] buffer, ....)
{
if (NetEventSource.IsEnabled)
{
NetEventSource.Enter(this);
NetEventSource.Info(this,
"buffer.Length:" + buffer.Length + // <=
" size:" + size +
" offset:" + offset);
}
if (buffer == null) // <=
{
throw new ArgumentNullException(nameof(buffer));
}
....
}
Similar errors can be found in some other places:
V3095 The 'tx' object was used before it was verified against null. Check lines: 3282, 3285. TransactionState.cs 3282
internal override void EnterState(InternalTransaction tx)
{
if (tx._outcomeSource._isoLevel == IsolationLevel.Snapshot) // <=
{
throw TransactionException.CreateInvalidOperationException(
....,
tx == null ? Guid.Empty : tx.DistributedTxId); // <=
}
....
}
V3095 The 'rule' object was used before it was verified against null. Check lines: 2180, 2181. CodeFixProvider.cs 2180
internal static string GetFirstRuleName(ClassDeclarationSyntax declaration)
{
SyntaxList<MemberDeclarationSyntax> members = declaration.Members;
FieldDeclarationSyntax rule = null;
foreach (MemberDeclarationSyntax member in members)
{
rule = member as FieldDeclarationSyntax;
var ruleType = rule.Declaration.Type as IdentifierNameSyntax;
if (rule != null
&& ruleType != null
&& ruleType.Identifier.Text == "DiagnosticDescriptor")
{break;}
rule = null;
}
....
}
V3095 [CWE-476] The 'pi' object was used before it was verified against null. Check lines: 801, 803. ImageHelpers.cs 801
public static bool AddMetadata(Image img, int id, string text)
{
....
pi.Value = bytesText; // <=
if (pi != null)
{
img.SetPropertyItem(pi);
return true;
}
....
}
V3095 [CWE-476] The 'task' object was used before it was verified against null. Check lines: 268, 270. TaskManager.cs 268
private static void Task_TaskCompleted(WorkerTask task)
{
....
task.KeepImage = false; // <=
if (task != null)
{
if (task.RequestSettingUpdate)
{
Program.MainForm.UpdateCheckStates();
}
....
}
....
}
Similar errors can be found in some other places:
V3095 The 'certificate' object was used before it was verified against null. Check lines: 41, 43. CertificateInfo.cs 41
public CertificateInfo(
....,
Azure.Management.Automation.Models.Certificate certificate)
{
....
this.Name = certificate.Name;
if (certificate == null) return;
....
}
Similar errors can be found in some other places:
V3095 The 'remoteClient' object was used before it was verified against null. Check lines: 49, 51. ImportRemoteInstanceController.cs 49
public async Task<IActionResult> Import(ImportViewModel model)
{
....
var remoteClient = remoteClientList.RemoteClients.FirstOrDefault(....);
var apiKey = Encoding.UTF8.GetString(....(remoteClient.ProtectedApiKey));
if (remoteClient == null || ....)
{
....
}
....
}
V3095 The 'httpRequest.Content.Headers' object was used before it was verified against null. Check lines: 76, 79. BatchSharedKeyCredential.cs 76
public override Task ProcessHttpRequestAsync(
HttpRequestMessage httpRequest, ....)
{
....
signature.Append(httpRequest.Content != null
&& httpRequest.Content.Headers.Contains("Content-Language") ? .... : ....;
long? contentLength = httpRequest.Content?.Headers?.ContentLength;
....
}
V3095 [CWE-476] The 'columns' object was used before it was verified against null. Check lines: 141, 142. SquareGraph.cs 141
private void redrawProgress()
{
for (int i = 0; i < ColumnCount; i++)
columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed;
columns?.ForceRedraw();
}
V3095 [CWE-476] The 'installedPackage' object was used before it was verified against null. Check lines: 910, 917. NugetService.cs 910
public virtual ConcurrentDictionary<string, PackageResult> get_outdated(....)
{
....
var pinnedPackageResult = outdatedPackages.GetOrAdd(
packageName,
new PackageResult(installedPackage,
_fileSystem.combine_paths(
ApplicationParameters.PackagesLocation,
installedPackage.Id)));
....
if ( installedPackage != null
&& !string.IsNullOrWhiteSpace(installedPackage.Version.SpecialVersion)
&& !config.UpgradeCommand.ExcludePrerelease)
{
....
}
....
}
V3095 The '_logger' object was used before it was verified against null. Check lines: 118, 118. Nethermind.Wallet DevKeyStoreWallet.cs 118
public void Sign(Transaction tx, int chainId)
{
if (_logger.IsDebug)
_logger?.Debug($"Signing transaction: {tx.Value} to {tx.To}");
IBasicWallet.Sign(this, tx, chainId);
}
Similar errors can be found in some other places:
V3095 The 'node.Indexer' object was used before it was verified against null. Check lines: 1180, 1182. ExpressionStringBuilder.cs(1180), ExpressionStringBuilder.cs(1182) Raven.Client
protected override Expression VisitIndex(IndexExpression node)
{
if (node.Object != null)
{
Visit(node.Object);
}
else
{
Out(node.Indexer.DeclaringType.Name); // <=
}
if (node.Indexer != null) // <=
{
Out(".");
Out(node.Indexer.Name);
}
VisitExpressions('[', node.Arguments, ']');
return node;
}
V3095 The 'r.Attributes["href"]' object was used before it was verified against null. Check lines: 86, 87. HelpCenterStorage.cs 86
public override void Init(string html, string helpLinkBlock, string baseUrl)
{
....
foreach (var href in hrefs.Where(r =>
{
var value = r.Attributes["href"].Value;
return r.Attributes["href"] != null
&& !string.IsNullOrEmpty(value)
&& !value.StartsWith("mailto:")
&& !value.StartsWith("http");
}))
{
....
}
....
}