Skip to content

Commit

Permalink
Merge #2987 Fix NRE on download errors in ConsoleUI
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Feb 5, 2020
2 parents 204ba8b + aeb7067 commit c7be649
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.

### Bugfixes
- [GUI] Fix null reference in recommendations (#2984 by: HebaruSan; reviewed: politas)
- [ConsoleUI] Fix NRE on download errors in ConsoleUI (#2987 by: HebaruSan; reviewed: politas, DasSkelett)

### Internal

Expand Down Expand Up @@ -86,7 +87,7 @@ All notable changes to this project will be documented in this file.
- [Multiple] Fixes for KSP in Windows drive root (#2857 by: HebaruSan; reviewed: DasSkelett)
- [GUI] Use current metadata for installed module compatibility (#2886 by: HebaruSan; reviewed: DasSkelett)
- [Core] Notify when falling back to archive.org URL (#2892 by: HebaruSan; reviewed: DasSkelett)
- [Multiple] Only run Mono in 32bit mode when the GUI is launched (#2893 by: DaskSkelett; reviewed: HebaruSan)
- [Multiple] Only run Mono in 32bit mode when the GUI is launched (#2893 by: DasSkelett; reviewed: HebaruSan)
- [Build] Force logical name for generated resources (#2899 by: DasSkelett; reviewed: HebaruSan)
- [GUI] Show target version for upgrades in change set (#2888 by: HebaruSan; reviewed: DasSkelett)
- [Netkan] Merge resources and include metanetkan (#2913 by: HebaruSan; reviewed: DasSkelett)
Expand Down
1 change: 1 addition & 0 deletions ConsoleUI/CKAN-ConsoleUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions ConsoleUI/Toolkit/ConsoleTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ public ConsoleTextBox(
/// <param name="line">String to add</param>
public void AddLine(string line)
{
lines.AddRange(Formatting.WordWrap(line, GetRight() - GetLeft() + 1));
// AddRange isn't thread-safe, it temporarily pads with nulls
foreach (string subLine in Formatting.WordWrap(line, GetRight() - GetLeft() + 1)) {
lines.Add(subLine);
}
if (scrollToBottom) {
ScrollToBottom();
} else {
Expand Down Expand Up @@ -213,7 +216,7 @@ public void AddScrollBindings(ScreenContainer cont, bool drawMore = false)
private bool scrollToBottom;
private int topLine;
private TextAlign align;
private List<string> lines = new List<string>();
private SynchronizedCollection<string> lines = new SynchronizedCollection<string>();
private Func<ConsoleColor> getBgColor;
private Func<ConsoleColor> getFgColor;
}
Expand Down

0 comments on commit c7be649

Please sign in to comment.