smartdevicelink/sdl_javascript_suite

SoftButtonReplaceOperation Null Access Error

Closed this issue · 0 comments

Bug Report

Issue is based on this: smartdevicelink/sdl_java_suite#1767

_SoftButtonReplaceOperation's _softButtonCapabilities can be null, and attempting to call _supportsSoftButtonImages can cause an error.

Reproduction Steps
  1. Set Template that does not support Softbuttons
  2. In batch update change the layout to one that does support Softbuttons and add Softbuttons in the update
Expected Behavior

Soft buttons appear on screen

Observed Behavior

Crash happens in library due to null access

Browser & Version Information

Tested on 1.5, bug in all environments.

Test Case, Sample Code, and / or Example App
            const screenManager = this._sdlManager.getScreenManager();

            screenManager.changeLayout(new SDL.rpc.structs.TemplateConfiguration()
                .setTemplate(SDL.rpc.enums.PredefinedLayout.LARGE_GRAPHIC_ONLY));

            await this._sleep(2500);

            const templateConfiguration = new SDL.rpc.structs.TemplateConfiguration()
                .setTemplate(SDL.rpc.enums.PredefinedLayout.GRAPHIC_WITH_TEXTBUTTONS);

            const softButtonState = new SDL.manager.screen.utils.SoftButtonState("State1", "Text1", null);
            const softButtonObject = new SDL.manager.screen.utils.SoftButtonObject("Button1", softButtonState, "State1");

            screenManager.beginTransaction();
            screenManager.setTextField1("hi");
            screenManager.setTextField2("hi as well");
            screenManager.setTitle("0uch");
            screenManager.setSoftButtonObjects([softButtonObject]);
            screenManager.changeLayout(templateConfiguration);
            screenManager.commit();