ungerik / go-cairo

Go binding for the cairo graphics library
Other
142 stars 32 forks source link

NewSurfaceFromImage panics every time #7

Closed farhaven closed 8 years ago

farhaven commented 9 years ago

Hi,

the last call to panic in surface.go seems to be misplaced, resulting in a runtime panic everytime cairo.NewSurfaceFromImage is called. This patch fixes the issue:

diff --git a/surface.go b/surface.go
index 3409279..9e1d655 100644
--- a/surface.go
+++ b/surface.go
@@ -724,6 +724,8 @@ func (self *Surface) SetImage(img image.Image) {

    case FORMAT_INVALID:
        panic("Invalid surface format")
+
+   default:
+       panic("Unknown surface format")
    }
-   panic("Unknown surface format")
 }
ungerik commented 9 years ago

Thanks, fixed :-)

-Erik

On Wed, Feb 4, 2015 at 10:22 PM, Gregor Best notifications@github.com wrote:

Hi,

the last call to panic in surface.go seems to be misplaced, resulting in a runtime panic everytime cairo.NewSurfaceFromImage is called. This patch fixes the issue:

diff --git a/surface.go b/surface.go index 3409279..9e1d655 100644 --- a/surface.go +++ b/surface.go @@ -724,6 +724,8 @@ func (self *Surface) SetImage(img image.Image) {

case FORMAT_INVALID:
    panic("Invalid surface format")

+

  • default:
  • panic("Unknown surface format") }
  • panic("Unknown surface format") }

— Reply to this email directly or view it on GitHub https://github.com/ungerik/go-cairo/issues/7.

+43 650 58 33055 erik@erikunger.com Skype: ungerik http://erikunger.com http://github.com/ungerik http://twitter.com/ungerik http://facebook.com/ungerik http://www.linkedin.com/in/ungerik http://www.xing.com/profile/Erik_Unger2

dlespiau commented 8 years ago

I guess this issue can be closed then? :)

farhaven commented 8 years ago

From my side, yeah, of course :)