handle no script being passed
This commit is contained in:
parent
87394e7263
commit
ee984f7d72
|
@ -50,10 +50,6 @@ type script struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *milkDropWindow) loadScript(scriptPath string) error {
|
func (m *milkDropWindow) loadScript(scriptPath string) error {
|
||||||
if scriptPath == "" {
|
|
||||||
return errors.New("no script given")
|
|
||||||
}
|
|
||||||
|
|
||||||
f, err := os.Open(scriptPath)
|
f, err := os.Open(scriptPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -92,10 +88,13 @@ func (m *milkDropWindow) prevPreset() {
|
||||||
|
|
||||||
func newMilkDropWindow(width, height int32, scriptPath string) (*milkDropWindow, error) {
|
func newMilkDropWindow(width, height int32, scriptPath string) (*milkDropWindow, error) {
|
||||||
var m milkDropWindow
|
var m milkDropWindow
|
||||||
|
var err error
|
||||||
|
|
||||||
err := m.loadScript(scriptPath)
|
if scriptPath != "" {
|
||||||
if err != nil {
|
err = m.loadScript(scriptPath)
|
||||||
return nil, err
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m.window, err = sdl.CreateWindow("milkbucket", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED, width, height, sdl.WINDOW_OPENGL|sdl.WINDOW_RESIZABLE)
|
m.window, err = sdl.CreateWindow("milkbucket", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED, width, height, sdl.WINDOW_OPENGL|sdl.WINDOW_RESIZABLE)
|
||||||
|
|
Loading…
Reference in New Issue