Skip to content

Commit

Permalink
fix #1127 - Nelson could crash if an mxn characters is displayed in t…
Browse files Browse the repository at this point in the history
…he variable browser
  • Loading branch information
Nelson-numerical-software committed Mar 19, 2024
1 parent a5f48dc commit 7f0f0b6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- [#1110](http://github.com/nelson-lang/nelson/issues/1110) add help about build and use C/C++ on fly.
- [#1127](http://github.com/nelson-lang/nelson/issues/1127) Nelson could crash if an mxn characters is displayed in the variable browser.
- Missing 'zoom in', 'zoom out' icons for help viewer in linux package.
- `gcd` without argument returned wrong error message.

Expand Down
8 changes: 6 additions & 2 deletions modules/gui/src/cpp/QtWorkspaceBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,14 @@ QtWorkspaceBrowser::handleLogicalVariable(const ArrayOf* variable) const
QString
QtWorkspaceBrowser::handleCharVariable(const ArrayOf* variable) const
{
if (variable->isScalar()) {
if (variable->isEmpty()) {
return "''";
} else {
return wstringToQString(L"\'" + variable->getContentAsWideString() + L"\'");
if (variable->isRowVector() || variable->isScalar()) {
return wstringToQString(L"\'" + variable->getContentAsWideString() + L"\'");
} else {
return wstringToQString(variable->getDimensions().toWideString() + L" char");
}
}
}
//=============================================================================
Expand Down
19 changes: 19 additions & 0 deletions modules/gui/tests/bug_github_issue_#1127.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
%=============================================================================
% Copyright (c) 2017 Allan CORNET (Nelson)
%=============================================================================
% This file is part of the Nelson.
%=============================================================================
% LICENCE_BLOCK_BEGIN
% SPDX-License-Identifier: LGPL-3.0-or-later
% LICENCE_BLOCK_END
%=============================================================================
% <-- Issue URL -->
% https://github.com/nelson-lang/nelson/issues/121
% <-- Short Description -->
% Nelson could crash if an mxn characters is displayed in the variable browser.
%=============================================================================
% <--GUI MODE-->
A = 'g';
B = 'Test';
C = [B;B]
disp(C);

0 comments on commit 7f0f0b6

Please sign in to comment.