Skip to content

Commit 21d0243

Browse files
committed
Merge pull request #918 from mjbvz/fix-repl-window-null-deref
Fix Repl window null deref when main NTVS package has not been loaded yet
2 parents 74311ca + 894ce53 commit 21d0243

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Common/Product/SharedProject/CommonPackage.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ internal void RegisterCommands(IEnumerable<Command> commands, Guid cmdSet) {
129129
/// </summary>
130130
/// <returns></returns>
131131
public static IWpfTextView GetActiveTextView(System.IServiceProvider serviceProvider) {
132+
if (serviceProvider == null) {
133+
Debug.Assert(false, "No service provider");
134+
return null;
135+
}
136+
132137
var monitorSelection = (IVsMonitorSelection)serviceProvider.GetService(typeof(SVsShellMonitorSelection));
133138
if (monitorSelection == null) {
134139
return null;
@@ -174,6 +179,10 @@ public static IComponentModel ComponentModel {
174179
}
175180

176181
internal static CommonProjectNode GetStartupProject(System.IServiceProvider serviceProvider) {
182+
if (serviceProvider == null) {
183+
Debug.Assert(false, "No service provider");
184+
return null;
185+
}
177186
var buildMgr = (IVsSolutionBuildManager)serviceProvider.GetService(typeof(IVsSolutionBuildManager));
178187
IVsHierarchy hierarchy;
179188
if (buildMgr != null && ErrorHandler.Succeeded(buildMgr.get_StartupProject(out hierarchy)) && hierarchy != null) {

0 commit comments

Comments
 (0)