M module-gui/gui/core/FontManager.cpp => module-gui/gui/core/FontManager.cpp +4 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "FontManager.hpp"
@@ 45,6 45,9 @@ namespace gui
{
auto file = std::fopen(filename.c_str(), "rb");
+ if (file == nullptr) {
+ return nullptr;
+ }
auto fileSize = std::filesystem::file_size(filename);
std::rewind(file);
M module-gui/gui/core/ImageManager.cpp => module-gui/gui/core/ImageManager.cpp +3 -0
@@ 75,6 75,9 @@ namespace gui
{
auto file = std::fopen(filename.c_str(), "rb");
+ if (file == nullptr) {
+ return nullptr;
+ }
auto fileSize = std::filesystem::file_size(filename);
M module-gui/gui/widgets/Text.cpp => module-gui/gui/widgets/Text.cpp +0 -11
@@ 191,17 191,6 @@ namespace gui
return document->getText();
}
- bool Text::saveText(UTF8 path)
- {
- if (auto file = std::fopen(path.c_str(), "wb")) {
- auto text = getText();
- std::fwrite(text.c_str(), text.length(), text.length(), file);
- std::fclose(file);
- return true;
- }
- return false;
- }
-
void Text::setFont(const UTF8 &fontName)
{
RawFont *newFont = FontManager::getInstance().getFont(fontName);
M module-gui/gui/widgets/Text.hpp => module-gui/gui/widgets/Text.hpp +0 -2
@@ 154,8 154,6 @@ namespace gui
virtual void clear();
bool isEmpty();
virtual UTF8 getText() const;
- /// saves text from widget to file at specified path
- virtual bool saveText(UTF8 path);
void setFont(const UTF8 &fontName);
void setFont(RawFont *font);
void setMinimumWidthToFitText(const UTF8 &text);