fixing null refernces

This commit is contained in:
LarsBrubaker 2022-03-24 08:32:32 -07:00
parent 40e729f05f
commit 18be37d464
4 changed files with 27 additions and 7 deletions

View file

@ -297,6 +297,12 @@ namespace MatterHackers.MatterControl.DesignTools
public static GuiWidget CreatePropertyEditor(SafeList<SettingsRow> rows, EditableProperty property, UndoBuffer undoBuffer, PPEContext context, ThemeConfig theme)
{
if (property == null
|| context == null)
{
return null;
}
var localItem = context.item;
var object3D = property.Item;
var propertyGridModifier = property.Item as IPropertyGridModifier;

View file

@ -33,6 +33,7 @@ using System.IO;
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.DataStorage;
@ -83,9 +84,16 @@ namespace MatterHackers.MatterControl.Library
internal ILibraryItem NewBedPlate(BedConfig bedConfig)
{
var name = bedConfig.Printer.PrinterName;
string now = DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss");
var filename = ApplicationController.Instance.SanitizeFileName($"{name} - {now}.mcx");
string mcxPath = Path.Combine(this.FullPath, filename);
var mcxPath = "";
var startTime = UiThread.CurrentTimerMs;
// try to get a valid filename for up to 3 seconds (3 tries at an unused filename)
while (File.Exists(mcxPath)
&& UiThread.CurrentTimerMs < startTime + 3000)
{
string now = DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss");
var filename = ApplicationController.Instance.SanitizeFileName($"{name} - {now}.mcx");
mcxPath = Path.Combine(this.FullPath, filename);
}
File.WriteAllText(mcxPath, new Object3D().ToJson().Result);

View file

@ -265,11 +265,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.TabBar.MouseMove += (s, e) =>
{
if (e?.DragFiles?.Count > 0
&& e.DragFiles.Where(f => ApplicationController.ShellFileExtensions.Contains(Path.GetExtension(f).ToLower())).Any())
try
{
e.AcceptDrop = true;
if (e?.DragFiles?.Count > 0
&& e.DragFiles.Where(f => ApplicationController.ShellFileExtensions.Contains(Path.GetExtension(f).ToLower())).Any())
{
e.AcceptDrop = true;
}
}
catch
{
}
};
TabBar.MouseEnterBounds += (s, e) =>

@ -1 +1 @@
Subproject commit 11ebc78b76712d4a34c1fade8030a29f2799261b
Subproject commit d3ceb0f48a56be29dcd7639d92371a8f1e27f422