mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-25 23:57:53 +03:00
ecode: Don't crash if the terminal could not initialize.
Closes issue SpartanJ/ecode#81.
This commit is contained in:
@@ -39,8 +39,10 @@ bool UITerminal::isType( const Uint32& type ) const {
|
||||
}
|
||||
|
||||
void UITerminal::draw() {
|
||||
mTerm->setPosition( mScreenPosi.asFloat() );
|
||||
mTerm->draw();
|
||||
if ( mTerm ) {
|
||||
mTerm->setPosition( mScreenPosi.asFloat() );
|
||||
mTerm->draw();
|
||||
}
|
||||
}
|
||||
|
||||
UITerminal::UITerminal( const std::shared_ptr<TerminalDisplay>& terminalDisplay ) :
|
||||
@@ -49,6 +51,8 @@ UITerminal::UITerminal( const std::shared_ptr<TerminalDisplay>& terminalDisplay
|
||||
mVScroll( UIScrollBar::NewVertical() ),
|
||||
mTerm( terminalDisplay ) {
|
||||
mFlags |= UI_TAB_STOP;
|
||||
if ( !terminalDisplay )
|
||||
return;
|
||||
mTerm->pushEventCallback( [&]( const TerminalDisplay::Event& event ) {
|
||||
switch ( event.type ) {
|
||||
case TerminalDisplay::EventType::TITLE: {
|
||||
@@ -297,6 +301,8 @@ const std::shared_ptr<TerminalDisplay>& UITerminal::getTerm() const {
|
||||
}
|
||||
|
||||
void UITerminal::scheduledUpdate( const Time& ) {
|
||||
if ( !mTerm )
|
||||
return;
|
||||
mTerm->update();
|
||||
|
||||
if ( mTerm->isDirty() )
|
||||
|
||||
@@ -258,6 +258,15 @@ UITerminal* TerminalManager::createNewTerminal( const std::string& title, UITabW
|
||||
mApp->termConfig().fontSize.asPixels( 0, Sizef(), mApp->getDisplayDPI() ), initialSize,
|
||||
program, args, !workingDir.empty() ? workingDir : mApp->getCurrentWorkingDir(), 10000,
|
||||
nullptr, mUseFrameBuffer );
|
||||
if ( term->getTerm() == nullptr ) {
|
||||
UIMessageBox* msgBox = UIMessageBox::New(
|
||||
UIMessageBox::OK,
|
||||
mApp->i18n( "feature_not_supported_in_os",
|
||||
"This feature is not supported in this Operating System" ) );
|
||||
msgBox->showWhenReady();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
term->getTerm()->getTerminal()->setAllowMemoryTrimnming( true );
|
||||
auto ret = mApp->getSplitter()->createWidgetInTabWidget(
|
||||
tabWidget, term, title.empty() ? mApp->i18n( "shell", "Shell" ).toUtf8() : title, true );
|
||||
|
||||
Reference in New Issue
Block a user